繁体   English   中英

jQuery Mobile + iscroll4 +动态页面加载

[英]Jquery Mobile + iscroll4 + dynamic page load

我是StackOverflow的新手,这是我的第一个问题,所以如果我做错了事,请原谅。

我的问题是如何使iScroll 4在页面上的多个div上工作,该页面是使用load()方法动态加载的。

因此,将其分解为更简单的内容:

我有一个单独的页面,称为page.html

<html>
      <body>

            <ul data-iscroll="scroller">
               ..lots of data..
            </ul>

            <ul data-iscroll="scroller">
               ..lots of data..
            </ul>

      </body>
</html>

然后在我的index.html页面上,我具有所有库的常规标头标记,并且这样加载就很好了(我知道它可以正常工作,因为当我在index.html页面中实际拥有列表时-> iScroll可以正常工作。只是当列表为动态加载)

我的index.html的主体是

<body>

      <div data-role="page>
            <div data-role="header" data-position="fixed">
                  <h3>header</h3>
            </div>

            <div data-role="content" id="content">
                 <!-- always empty - data will be loaded here -->
            </div>

            <div data-role="footer" data-position="fixed">
                 <h3>footer</h3>
            </div>
      </div>

</body>

页面被加载到内容中(由于我可以看到所有内容,因此也可以)

$("#content").load("page.html",function(){
    $("#content").trigger('create');
});

就像您也知道的那样,我包含的库是

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.min.js"></script>
<!-- jScroll -->
<script src="iscroll.js" type="text/javascript"></script>
<script src="jquery.mobile.iscrollview.js" type="text/javascript"></script>

当我使用Chrome检查元素时,将显示所有数据,并且一切都存在,但是2 <ul>不会像我期望的那样单独滚动。 有人知道我在做什么错吗?

PS。 我还在使用python -m SimpleHTTPServer 8013的简单服务器上运行此代码,并通过PhoneGap运行Ripple模拟器来测试屏幕分辨率,因为这将用于手机。

这可以帮助你理解和唯一的你的问题,我希望..如果你还不清楚,让我知道我会进一步解释你...... 我约iScroll简短的解释是这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM