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 http://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
});
The fork here modifies the plugin to do what you’re after: https://github.com/thatericsmith/infinite-scroll/blob/343cd297c70f1f8a486cd02cea28cf826b7af7c5/jquery.infinitescroll.js