[英]Jquery Mobile + iscroll4 + dynamic page load
I'm new to StackOverflow and this is my first question so excuse me if I'm doing something wrong. 我是StackOverflow的新手,这是我的第一个问题,所以如果我做错了事,请原谅。
My question is how to get iScroll 4 to work on multiple divs on a page where that page was dynamically loaded using the load() method. 我的问题是如何使iScroll 4在页面上的多个div上工作,该页面是使用load()方法动态加载的。
So to break it down into something more simple: 因此,将其分解为更简单的内容:
I have a separate page called page.html 我有一个单独的页面,称为page.html
<html>
<body>
<ul data-iscroll="scroller">
..lots of data..
</ul>
<ul data-iscroll="scroller">
..lots of data..
</ul>
</body>
</html>
Then on my index.html page I have the usual header tags with all libraries and such loaded fine (I know it works because when I have the list actually in the index.html page -> iScroll works fine. Just not when the list is loaded dynamically) 然后在我的index.html页面上,我具有所有库的常规标头标记,并且这样加载就很好了(我知道它可以正常工作,因为当我在index.html页面中实际拥有列表时-> iScroll可以正常工作。只是当列表为动态加载)
The body of my index.html is 我的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>
Pages are loaded into the content by (which also works because I can see everything) 页面被加载到内容中(由于我可以看到所有内容,因此也可以)
$("#content").load("page.html",function(){
$("#content").trigger('create');
});
And just so that you also know, my included libraries are 就像您也知道的那样,我包含的库是
<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>
All the data is displayed and everything is there when I inspect the element using Chrome but the 2 <ul>
does not scroll separately like I expect it to. 当我使用Chrome检查元素时,将显示所有数据,并且一切都存在,但是2
<ul>
不会像我期望的那样单独滚动。 Does anyone know what I'm doing wrong? 有人知道我在做什么错吗?
PS. PS。 I'm also running this on a simple server using
python -m SimpleHTTPServer 8013
and running the Ripple emulator by PhoneGap to test screen resolutions and such because this will be for the mobile phones. 我还在使用
python -m SimpleHTTPServer 8013
的简单服务器上运行此代码,并通过PhoneGap运行Ripple模拟器来测试屏幕分辨率,因为这将用于手机。
这可以帮助你理解和唯一的你的问题,我希望..如果你还不清楚,让我知道我会进一步解释你...... 我约iScroll简短的解释是这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.