2014-03-12 2 views
0

jquery 모바일 1.4.0을 사용하여 작은 webapp를 만들고 반응 형 목록을 만드는 데 어려움이 있습니다. 나는 다음 코드 (! 나는이과의 관련이없는 것처럼 PHP를 삭제했습니다) 한jquery 모바일 응답 목록 디자인

<div class='bespoke-bp'> 
     <ul data-role='listview' data-inset='true' data-divider-theme='a'> 
      <li data-role='list-divider'> 
       <div class='container_12'> 
        <div class='grid_15'> 
         <div class='ui-grid-b'> 
          <div class='ui-block-a'><div class='ui-bar ui-bar-a' style='height:15px'>Type</div></div> 
          <div class='ui-block-b'><div class='ui-bar ui-bar-a' style='height:15px'>Number</div></div> 
          <div class='ui-block-c'><div class='ui-bar ui-bar-a' style='height:15px'>Primary</div></div> 
         </div> 
        </div> 
       </div> 
      </li>  
      <li> 
       <div class='container_12'> 
        <div class='grid_15'> 
         <a href='#phoneOrEmail' data-rel='popup' data-position-to='window' data-transition='pop' > 
          <div class='ui-grid-b'> 
           <div class='ui-block-a'><div id='contactDesc' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['description'] . "</div></div> 
           <div class='ui-block-b'><div id='contactNo' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['number'] . "</div></div> 
           <div class='ui-block-c'><div id='contactPri' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['thePriNo'] . "</div></div> 
          </div> 
         </a> 
        </div> 
        <div class='grid_120'> 
         <a href='#editContact' data-rel='popup' data-position-to='window' data-transition='pop' style='padding:0px; margin:0px; border:0px; float: right;' class='ui-btn ui-btn-inline ui-icon-edit ui-btn-icon-notext'>Edit</a> 
        </div> 
       </div> 
      </li>     
     </ul> 
    </div> <!-- BESPOKE-BP end --> 

난이 매우 기본적인 반응 CSS를 가지고 :

/* stack all grids below 40em (640px) */ 
@media all and (max-width: 35em) { 
.bespoke-bp .ui-block-a, 
.bespoke-bp .ui-block-b, 
.bespoke-bp .ui-block-c, 
.bespoke-bp .ui-block-d, 
.bespoke-bp .ui-block-e { 
    width: 100%; 
    float: none; 
} 

}

/* Position the title next to the rank, pad to the left */ 
.bespoke-bp .list-divider .ui-block-a, 
.bespoke-bp .list-divider .ui-block-b, 
.bespoke-bp .list-divider .ui-block-c, 
.bespoke-bp .list-divider .ui-block-d, 
.bespoke-bp .list-divider .ui-block-e { 
    margin-top: -2.1em; 
    padding-left: 2.2em; 
    border-bottom: 1px solid rgba(0,0,0,.15); 
} 

나는 머리 글자가 서로 쌓여서 각 줄에 쌓이게되는 대신에 다음과 같이 더 멋지게 만들고 싶습니다.

개에 대한 유형

thetype

thenumber

theprimary

채널 행.

어디서부터 시작해야할지 모르겠으므로 아무에게도 올바른 방향을 제시 할 수 있습니까?

감사

+0

뭔가있다 anker/N2qpD /? 리플 로우 테이블을 볼 수도 있습니다. http://demos.jquerymobile.com/1.4.2/table-reflow/ – ezanker

+0

답장을 보내 주셔서 감사합니다. Thats great 그러나 두 개 이상의 행이있을 때 각 행에 여전히 헤더가 표시되므로 목록이 응답 할 때만이 작업을 수행하기를 원합니다. 이걸 어떻게 끝내는 지 알아? http://jsfiddle.net/N2qpD/1/ – Janey

+0

네, 아래 내 대답을 참조하십시오 ... – ezanker

답변

1

당신은 와이드 스크린의 좁은 화면 각 LI에서 모두 하나 개의 목록 분할에 열 제목을 포함 할 수 있습니다. 그런 다음 CSS 쇼/미디어 쿼리 적절한 제목을 숨길 다음 CSS에서

<div class='bespoke-bp'> 
    <ul data-role="listview" data-split-icon="edit" data-inset='true'> 
     <li data-role='list-divider' class="titleRowDivider"> 
      <div class='ui-grid-b'> 
       <div class='ui-block-a'><div class='ui-bar ui-bar-a' style='height:15px'>Type</div></div> 
       <div class='ui-block-b'><div class='ui-bar ui-bar-a' style='height:15px'>Type</div></div> 
       <div class='ui-block-c'><div class='ui-bar ui-bar-a' style='height:15px'>Type</div></div>       
      </div> 
     </li> 
     <li> 
      <a href='#phoneOrEmail' data-rel='popup' data-position-to='window' data-transition='pop'> 
       <div class='ui-grid-b'> 
        <div class='ui-block-a'> 
         <div class='ui-bar ui-bar-a titleRow' style='height:15px'>Type</div> 
         <div id='contactDesc' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['description'] . "</div> 
        </div> 
        <div class='ui-block-b'> 
         <div class='ui-bar ui-bar-a titleRow' style='height:15px'>Number</div> 
         <div id='contactNo' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['number'] . "</div> 
        </div> 
        <div class='ui-block-c'> 
         <div class='ui-bar ui-bar-a titleRow' style='height:15px'>Primary</div> 
         <div id='contactPri' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['thePriNo'] . "</div> 
        </div> 
       </div> 
      </a> 
      <a href='#editContact' data-rel='popup' data-position-to='window' data-transition='pop'>Purchase album</a>     
     </li>     
     <li> 
      <a href='#phoneOrEmail' data-rel='popup' data-position-to='window' data-transition='pop'> 
       <div class='ui-grid-b'> 
        <div class='ui-block-a'> 
         <div class='ui-bar ui-bar-a titleRow' style='height:15px'>Type</div> 
         <div id='contactDesc' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['description'] . "</div> 
        </div> 
        <div class='ui-block-b'> 
         <div class='ui-bar ui-bar-a titleRow' style='height:15px'>Number</div> 
         <div id='contactNo' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['number'] . "</div> 
        </div> 
        <div class='ui-block-c'> 
         <div class='ui-bar ui-bar-a titleRow' style='height:15px'>Primary</div> 
         <div id='contactPri' class='ui-bar ui-bar-a' style='height:15px; background-color:transparent; border: none; color: #000000; font-weight: normal;'>" . $row['thePriNo'] . "</div> 
        </div> 
       </div> 
      </a> 
      <a href='#editContact' data-rel='popup' data-position-to='window' data-transition='pop'>Purchase album</a>     
     </li>     
    </ul> 
</div> 

, 디바이더가 표시되고 화면 크기가이 상태가 반전되는 시점에 35em 이하가 될 때까지 반복 제목은 숨겨져 있습니다 : http://jsfiddle.net/ez :

여기
.bespoke-bp .titleRow { 
    display: none; 
} 
.bespoke-bp .titleRowDivider{ 
    display: block; 
} 
/* stack all grids below 40em (640px) */ 
@media all and (max-width: 35em) { 
    .bespoke-bp .ui-block-a, 
    .bespoke-bp .ui-block-b, 
    .bespoke-bp .ui-block-c, 
    .bespoke-bp .ui-block-d, 
    .bespoke-bp .ui-block-e { 
     width: 100%; 
     float: none; 
    } 
    .bespoke-bp .titleRow { 
     display: block; 
    }  
    .bespoke-bp .titleRowDivider{ 
     display: none !important; 
    } 
} 

이 같은 DEMO

+0

와우 그것이 내가 원했던 것입니다! 정말 고마워!! : D – Janey

+0

당신은 오신 것을 환영합니다! – ezanker