它看起来不适用于下面的代码,它有什么问题?它不起作用,也没有错误。
<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>
答案 0 :(得分:0)
尝试在导航中添加包装元素,这样就不会对两个不同的项目使用相同的ID。
此外,您不需要:
nextSelector: #next:last
只需使用:
nextSelector: #next
它可能是:最后打破它 - 尝试使用Firebug / web检查器,看看你的第一页上有什么$('#next:last')返回,但很可能是缺少分页容器。