我从http://andersonferminiano.com/jqueryscrollpagination获得了这个脚本。它是一个无限卷轴,我喜欢它,但我有一个问题。例如我有这个页面。 democontent.html包含100个结果。这个脚本只是在一个页面中从该页面获取所有结果,并一次又一次地循环相同的结果,这使得我的页面加载非常困难。并且我希望以某种方式让我在第一次分页时给我20分,在第二次分页时再给我20分,而不是循环相同的结果。可能吗? 这是功能:
$(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();
}
}
});