Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // unbind normal behavior. needs to occur after normal infinite scroll setup.
- $(window).unbind('.infscr');
- // call this whenever you want to retrieve the next page of content
- // likely this would go in a click handler of some sort
- $(document).trigger('retrieve.infscr');
- <div id="items">
- <!-- Run your query using the page parameter to offset items, then display the items here -->
- </div>
- <button id="more">More</button>
- var page = 0;
- $('#more').click(function(){
- page++;
- $('<div/>').appendTo('#items').load('the/same/url/?page='+page+' #items');
- });
- $('.container').infinitescroll({
- // infinite scroll options
- },
- function(){
- // pause when new elements are loaded
- $('.container').infinitescroll('pause')
- }
- );
- function resume_infinite_scroll(){
- // resume
- $('.container').infinitescroll('resume')
- // check if new elements should be loaded
- $('.container').infinitescroll('scroll')
- }
- <button onclick="resume_infinite_scroll()">load more</button>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement