我使用来自互联网的名为“jqueryscrollpagination”的脚本在用户滚动到底部时自动加载内容,因为我的页面太长了。实时链接- http://www.arif-khan.net/project/chuck/jobOpening.html
我的问题是它在底部滚动后再次显示相同的内容。我该如何解决?
Javascript代码-
<script type="text/javascript">
$(function(){
$('#content').scrollPagination({
'contentPage': 'more_content.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() > 100){ // if more than 100 results already loaded, then stop pagination (only for testing)
$('#nomoreresults').fadeIn();
$('#content').stopScrollPagination();
}
}
});
// code for fade in element by element
$.fn.fadeInWithDelay = function(){
var delay = 0;
return this.each(function(){
$(this).delay(delay).animate({opacity:1}, 200);
delay += 100;
});
};
});
</script>
& 它还使用另一个脚本文件。在这里检查 - http://www.arif-khan.net/project/chuck/scripts/scrollpagination.js