1

I got this script from http://andersonferminiano.com/jqueryscrollpagination It is an infinit scroller and i like it but i have a problem with it. For example i have this page. democontent.html wich contain 100 results. This script just get me all the results from that page in a single pagination and loop the same results again and again, This makes my page to load very hard. and i wish to make it somehow to give me 20 on first pagination, another 20 in second pagination etc and not loop the same results. Is it possible? Here is the function:

$(function(){
$('#content').scrollPagination({
    'contentPage': 'democontent.html', // the url you are fetching the results
    'contentData': {}, // these are the variables you can pass to the request, for example: children().size() to know which page you are
    'scrollTarget': $(window), // who gonna scroll? in this example, the full window
    'heightOffset': 10, // it gonna request when scroll is 10 pixels before the page ends
    'beforeLoad': function(){ // before load function, you can display a preloader div
        $('#loading').fadeIn(); 
    },
    'afterLoad': function(elementsLoaded){ // after loading content, you can use this function to animate your new elements
         $('#loading').fadeOut();
         var i = 0;
         $(elementsLoaded).fadeInWithDelay();
         if ($('#content').children().size() > 200){ // if more than 100 results already loaded, then stop pagination (only for testing)
            $('#nomoreresults').fadeIn();
            $('#content').stopScrollPagination();
         }
    }
});
2
  • What i mean exactly is to make it load all the results but to show me only 20 per pagination Commented Sep 27, 2012 at 16:02
  • please see this question and answer: stackoverflow.com/questions/15027416/… Commented Mar 21, 2013 at 3:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.