2012-03-30 183 views
1

我正在使用jquerymobile和滾動視圖來啓用div上的水平滾動。但是我在滾動後擡起手指時遇到問題。它回到原來的位置,我不能選擇我想選擇的項目,因爲無法選擇滾動的內容。這是我的代碼Jquerymobile Scrollview在滾動後返回到原始位置。不保存滾動位置

<div data-scroll="x" style="min-width:10000px; width: auto !important; width: 10000px;border: solid 1px black; white-space: nowrap;"> 
<div style="width: 350px; float: left;margin-left: 60px;"> 
      <div data-role="collapsible" data-collapsed="true" data-iconpos="bottom"> 
       <h3>Morning</h3> 
      </div> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Afternoon</h3> 
      </div> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Evening</h3> 
      </div> 
     </div> 
     <div style="width: 350px; float: left;margin-left: 60px;"> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Morning</h3> 
      </div> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Afternoon</h3> 
      </div> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Evening</h3> 
      </div> 

     </div> 
     <div style="width: 350px; float: left;margin-left: 60px;"> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Morning</h3> 
      </div> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Afternoon</h3> 
      </div> 
      <div data-role="collapsible" data-collapsed="true" > 
       <h3>Evening</h3> 
      </div> 
     </div> 


    </div> 

因此,無法選擇第三個內部div中的項目,因爲它們在滾動時無法到達。我做錯了什麼。 ?我在scrollview的演示頁面上使用默認的js文件。也演示工作正常使用這些js文件

回答

1

知道這是一個古老的線程,它應該得到任何答案。今天我使用iscroll 4.2和iscrollview的最新版本遇到了同樣的問題。使用下面的小提琴:http://jsfiddle.net/Gajotres/952NJ/

索引頁

<div data-role="content"> 
    <div class="example-wrapper" data-iscroll> 
     <ul data-role="listview"> 
      <li><a href="#">Some link</a></li> 
      <li><a href="#">Some link</a></li> 
    </div>   
</div> 

<div data-theme="b" data-role="footer"> 
    <h1>Footer</h1> 
</div>  

我能得到我的代碼工作。顯然,iscrollview需要不同的數據角色div:頁面,頁眉,頁腳和內容才能工作。所以請確保你的代碼被放置在這些標籤中。