仿微博 无限滚动加载技术
2013-06-25 15:31
169 查看
新浪微博网页自动底部加载的效果很酷吧?其实这种叫做“无限滚动的翻页技术”,当你页面滑到列表底部时候无需点击就自动加载更多的内容。
其实有很多jQuery的插件都已经实现了这个效果,我们来介绍几个吧!
1、jQuery ScrollPagination
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;
});
};
});
2、 jQuery Screw
Screw (scroll + view) 是一个 jQuery 插件当用户滚动页面的时候加载内容,是一个无限滚动翻页的插件。
官方地址:https://github.com/jasonlau/jQuery-Screw
3. AutoBrowse jQuery Plugin
Autobrowse jQuery Plugin 插件在用户滚动页面的时候自动通过 Ajax 加载更多内容,使用浏览器内置缓存。
官方地址:https://github.com/msjolund/jquery-esn-autobrowse
其实有很多jQuery的插件都已经实现了这个效果,我们来介绍几个吧!
1、jQuery ScrollPagination
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;
});
};
});
2、 jQuery Screw
Screw (scroll + view) 是一个 jQuery 插件当用户滚动页面的时候加载内容,是一个无限滚动翻页的插件。
官方地址:https://github.com/jasonlau/jQuery-Screw
3. AutoBrowse jQuery Plugin
Autobrowse jQuery Plugin 插件在用户滚动页面的时候自动通过 Ajax 加载更多内容,使用浏览器内置缓存。
官方地址:https://github.com/msjolund/jquery-esn-autobrowse
相关文章推荐
- Framework7学习笔记之 无限滚动(滚动到底部时加载新内容)
- jquery 实现滚动条下拉时无限加载
- 无限滚动加载(第一次请求完成后才发第二次请求)
- js滚动加载(无限加载)
- 移动端无限滚动加载 js实现原理
- AngularJS 无限滚动加载数据控件 ngInfiniteScroll
- JRoll 2 使用文档(史上最强大的下拉刷新,滚动,无限加载插件)
- AngularJS 无限滚动加载数据控件 ngInfiniteScroll
- 无限滚动加载最佳实践
- jQuery瀑布流实例无限滚动加载图片
- jquery 实现滚动条下拉时无限加载的简单实例
- Unity3D-UGUI无限滚动加载TableView列表
- jquery浏览器滚动加载技术实现方案
- jquery模仿微博向下滚动到页面底部时实时加载新内容
- Android仿微博加载长图滚动查看效果
- jquery 仿微博实现内容自动向下滚动加载
- jQuery--页面图片等元素滚动动态加载技术
- thinkphp+ajax 移动端实现滚动到底部加载数据(无刷新动态加载数据技术的应用)
- “无限滚动加载”适用于你的产品吗?
- 基于 Vue.js 的移动端组件库mint-ui实现无限滚动加载更多