我一直在试图添加无限滚动codeigniter的这个插件的分页。添加无限滚动到codeigniter分页
http://www.infinite-scroll.com
这是我的代码至今:
<script type = "text/javascript">
$('#comments').infinitescroll({
navSelector : "a#next:last", // selector for the paged navigation (it will be hidden)
nextSelector : "a#next:last", // selector for the NEXT link (to page 2)
itemSelector : "#comments" // selector for all items you'll retrieve
});
</script>
这是默认的使用。让我们假设#评论保留我的内容。我的分页页面看起来像这样。
http://localhost/ci/index.php/chat/load/p1u/10
http://localhost/ci/index.php/chat/load/p1u/20
等
我甚至已经添加这行代码,使其工作,但没有成功:
<a id="next" href="http://localhost/ci/index.php/chat/load/p1u/10">next page</a>
任何想法?
我找到了解决方法。我使用jquery来确定何时到达滚动div的末尾,并将load/p1u/10中的内容附加到html中。由于下一页显然是/ 20/30等等,我保留了一个全局变量,每次增加10,当窗口结束时。这工作正常,内容适当显示。 –