jQuery实现新浪微博自动底部加载的方法
2014-04-15 13:37
597 查看
jQuery ScrollPagination plugin 是一个jQuery 实现的支持无限滚动加载数据的插件。
地址:http://andersonferminiano.com/jqueryscrollpagination/
他的demo下载:http://andersonferminiano.com/jqueryscrollpagination/jqueryscrollpagination.zip
实例代码:
$(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() > 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;
});
};
});
地址:http://andersonferminiano.com/jqueryscrollpagination/
他的demo下载:http://andersonferminiano.com/jqueryscrollpagination/jqueryscrollpagination.zip
实例代码:
$(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() > 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;
});
};
});
相关文章推荐
- jQuery插件实现网页底部自动加载-类似新浪微博
- jQuery实现滚动到底部时自动加载更多的方法示例
- jQuery实现自动底部加载 类似于新浪微博
- 使用jquery实现页面滚动到底部自动加载新的信息
- 使用jquery实现页面滚动到底部自动加载新的信息
- javaScript和jQuery自动加载简单代码实现方法
- 使用jquery实现页面滚动到底部自动加载新的信息
- Android 下拉刷新框架实现、仿新浪微博、QQ好友动态滑到底部自动加载
- 使用jquery实现页面滚动到底部自动加载新的信息
- 使用jquery实现页面滚动到底部自动加载新的信息
- 使用jquery实现页面滚动到底部自动加载新的信息
- 使用jquery实现页面滚动到底部自动加载新的信息
- jQuery+ajax实现滚动到页面底部自动加载图文列表效果(类似图片懒加载)
- 使用jquery实现页面滚动到底部自动加载新的信息
- 仿新浪微博实现ListBox下拉刷新和到底部自动加载
- 使用jquery实现页面滚动到底部自动加载新的信息
- jQuery插件实现新浪微博自动底部加载
- Jquery的 scroll事件,实现当滚动条到达最底部时,自动加载新项
- 使用jquery实现页面滚动到底部自动加载新的信息
- Jquery的 scroll事件,实现当滚动条到达最底部时,自动加载新项