无限滚动不起作用?
看起来它不适用于下面的代码,有什么问题吗?它无法工作,也没有错误。
<h1> Infinite Scroll Demo </h1>
<div id="container">
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
</div>
<a id="next" href="demo2.html">next page</a>
<script src="js/jquery-1.6.1.js"></script>
<script src="js/jquery.infinitescroll.js"></script>
<script>
$('#container').infinitescroll({
navSelector : "#next:last",
nextSelector : "#next:last",
itemSelector : ".includeitem"
});
</script>
下面是 demo2.html 的代码,只是将一些 div 内容添加到首页。
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<a id="next" href="demo12.html">next page</a>
it looks it doesn't work with code below, what's wrong with it? it cannot work, no error as well.
<h1> Infinite Scroll Demo </h1>
<div id="container">
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
</div>
<a id="next" href="demo2.html">next page</a>
<script src="js/jquery-1.6.1.js"></script>
<script src="js/jquery.infinitescroll.js"></script>
<script>
$('#container').infinitescroll({
navSelector : "#next:last",
nextSelector : "#next:last",
itemSelector : ".includeitem"
});
</script>
Below is code for demo2.html, just some div content added to first page.
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<div class="includeitem"> www.gbin1.com </div>
<a id="next" href="demo12.html">next page</a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在导航中添加环绕元素,这样两个不同的项目就不会使用相同的 ID。
另外,您不需要:
只需使用:
可能是 :last 破坏了它 - 尝试使用 Firebug/web 检查器并查看 $('#next:last') 在您的第一页上返回什么,但很可能是缺少分页容器。
Try adding a wrapping element to your navigation so you aren't using the same ID for two differing items.
Also, you don't need:
just use:
It's possible it's the :last breaking it - try using Firebug/web inspector and see what $('#next:last') returns on your first page, but more than likely it's the lack of a pagination container.