2012-03-30 186 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:页面,页眉,页脚和内容才能工作。所以请确保你的代码被放置在这些标签中。