无限滚动一遍又一遍地加载第二页
我正在尝试使用 jQuery 插件 Infinate Scroll。
我遇到的问题是,当我滚动时,它会不断加载第二页。所以我认为
results page 1
results page 2
results page 2
results page 2
results page 2
No more results.
它确实结束了,这很奇怪,我认为它会永远继续下去。
为什么第 3 页永远无法加载。有谁熟悉无限滚动的内部工作原理并知道可能发生什么。似乎下一个按钮永远不会更新,并且每次都使用相同的光标。我需要更改我的分页系统吗?
我的下一个链接采用 www.mysite.com/page?cursor=al8sj6fa1jq3io4cm 第 3 页的形式,类似,但光标不同。
我的代码
$('#feed').infinitescroll({
debug: true,
// enable debug messaging ( to console.log )
navSelector : "div.feedNavBar:last",
// selector for the paged navigation (it will be hidden)
nextSelector : "div.feedNavBar:last .nextBTN",
// selector for the NEXT link (to page 2)
itemSelector : "#feed div.feedItem"
// selector for all items you'll retrieve
});
I am trying to use the jQuery plugin Infinate Scroll.
The problem I'm running into is that when I scroll, it keeps loading the second page. So I have
results page 1
results page 2
results page 2
results page 2
results page 2
No more results.
It does come to an end which is weird, I would think it would just keep going on forever.
Why does page 3 never load. Is anyone familiar with the inner workings of infinite scroll and know what may be happening. It seems like the next button is never updated and the same cursor is used each time. Do I need to make a change to my pagination system?
My next link is in the form www.mysite.com/page?cursor=al8sj6fa1jq3io4cm page 3 would be similar but would be a different cursor.
My Code
$('#feed').infinitescroll({
debug: true,
// enable debug messaging ( to console.log )
navSelector : "div.feedNavBar:last",
// selector for the paged navigation (it will be hidden)
nextSelector : "div.feedNavBar:last .nextBTN",
// selector for the NEXT link (to page 2)
itemSelector : "#feed div.feedItem"
// selector for all items you'll retrieve
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的 fork 修改了插件以执行您想要的操作: https://github.com/thatericsmith/infinite-scroll/blob/343cd297c70f1f8a486cd02cea28cf826b7af7c5/jquery.infinitescroll.js
The fork here modifies the plugin to do what you're after: https://github.com/thatericsmith/infinite-scroll/blob/343cd297c70f1f8a486cd02cea28cf826b7af7c5/jquery.infinitescroll.js