0712-2888027 189-8648-0214
微信公众号

孝感风信网络科技有限公司微信公众号

当前位置:主页 > 技术支持 > Javascript/JQuery > Infinite Scroll无限滚动加截数据插件

Infinite Scroll无限滚动加截数据插件

时间:2024-04-27来源:风信官网 点击: 751次
无限滚动(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 ..
});
栏目列表
推荐内容
热点内容
展开