无限滚动无限滚动数据切割插件Infinite Scroll

2022-11-18 0 14

 

无限滚动无限滚动数据切割插件Infinite Scroll

无限分页(Infinite Scroll)又称自动分页、滚动分页和无限分页。常用的形式是图片、文章或其他列表的网页,用于滚动页面自动加载下一页的内容。

 

 

官方网站:http://www.infinite-scroll.com

 

Infinite Scroll插件下载址:http://downloads.wordpress.org/plugin/infinite-scroll.zip

 

方法

 

Bind

$(‘.selector’).infinitescroll(‘bind’);

 

Unbind

$(‘.selector’).infinitescroll(‘unbind’);

 

Destroy

$(‘.selector’).infinitescroll(‘destroy’);

 

Pause

$(‘.selector’).infinitescroll(‘pause’);

 

Resume

$(‘.selector’).infinitescroll(‘resume’);

 

Toggle

$(‘.selector’).infinitescroll(‘toggle’);

 

Retrieve

$(‘.selector’).infinitescroll(‘retrieve’);

 

Scroll

$(‘.selector’).infinitescroll(‘scroll’);

 

Update

$(‘.selector’).infinitescroll(‘update’, {debug: true});

 

选项:

 

$(‘.selector’).infinitescroll({

loading: {

finished: undefined,

finishedMsg: “<em>Congratulations, you’ve reached the end of the internet.</em>”,

img: null,

msg: null,

msgText: “<em>Loading the next set of posts…</em>”,

selector: null,

speed: ‘fast’,

start: undefined

},

state: {

isDuringAjax: false,

isInvalidPage: false,

isDestroyed: false,

isDone: false, // For when it goes all the way through the archive.

isPaused: false,

currPage: 1

},

behavior: undefined,

binder: $(window), // used to cache the selector for the element that will be scrolling

nextSelector: “div.navigation a:first”,

navSelector: “div.navigation”,

contentSelector: null, // rename to pageFragment

extraScrollPx: 150,

itemSelector: “div.post”,

animate: false,

pathParse: undefined,

dataType: ‘html’,

appendCallback: true,

bufferPx: 40,

errorCallback: function () { },

infid: 0, //Instance ID

pixelsFromNavToBottom: undefined,

path: undefined, // Can either be an array of URL parts (e.g. [“/page/”, “/”]) or a function that accepts the page number and returns a URL

maxPage:undefined // to manually control maximum page (when maxPage is undefined, maximum page limitation is not work)

});

 

元素内部滚动示例:

 

$(‘.selector’).infinitescroll({

behavior: ‘local’,

binder: $(‘.selector’), // scroll on this element rather than on the window

// other options

});

 

读取JSON数据示例:

 

$(‘.selector’).infinitescroll({

// other options

dataType: ‘json’,

appendCallback: false

}, function(json, opts) {

// Get current page

var page = opts.state.currPage;

// Do something with JSON data, create DOM elements, etc ..

});

1. 本站所有资源来源于用户上传和网络,因此不包含技术服务请大家谅解!如有侵权请邮件联系客服!cheeksyu@vip.qq.com
2. 本站不保证所提供下载的资源的准确性、安全性和完整性,资源仅供下载学习之用!如有链接无法下载、失效或广告,请联系客服处理!
3. 您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容资源!如用于商业或者非法用途,与本站无关,一切后果请用户自负!
4. 如果您也有好的资源或教程,您可以投稿发布,成功分享后有积分奖励和额外收入!
5.严禁将资源用于任何违法犯罪行为,不得违反国家法律,否则责任自负,一切法律责任与本站无关

发表评论
暂无评论