0
我想在jsfiddle中使用javascript實現無限滾動分頁,但我遇到問題才能正常工作。我沒有看到滾動時的淡入淡出,當我到達內容的末尾時,我應該得到的消息是沒有更多的數據,但它表示它正在等待更多數據。無限滾動分頁javascript實現問題
原來的例子:http://andersonferminiano.com/jqueryscrollpagination/
我的實現:http://jsfiddle.net/jsuHD/
我添加了一個外部資源到的jsfiddle:scrollpagination.js
我想我的問題是使用JavaScript和不知道該怎麼通過爲contentPage
$(function(){
$('#content').scrollPagination({
'contentPage': 'http://jsfiddle.net/jsuHD/', // 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;
});
};
});
它是引發該錯誤的外部資源(滾動標記)。當複製到JavaScript的開始,一切工作。 http://jsfiddle.net/z9VAh/ – 2013-04-08 16:13:02