海南苯概企业管理有限公司

0712-2888027 189-8648-0214
微信公眾號

孝感風信網(wǎng)絡科技有限公司微信公眾號

當前位置:主頁 > 技術支持 > Javascript/JQuery > Infinite Scroll無限滾動加截數(shù)據(jù)插件

Infinite Scroll無限滾動加截數(shù)據(jù)插件

時間:2016-10-21來源:風信官網(wǎng) 點擊: 972次
無限滾動(Infinite Scroll)也稱為自動分頁、滾動分頁和無限分頁。常用在圖片、文章或其它列表形式的網(wǎng)頁中,用來在滾動網(wǎng)頁的時候自動加載下一頁的內(nèi)容。
 
官方網(wǎng)站: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)
});
 
元素內(nèi)部滾動示例:
 
$('.selector').infinitescroll({
  behavior: 'local',
  binder: $('.selector'), // scroll on this element rather than on the window
  // other options
});
 
讀取JSON數(shù)據(jù)示例:
 
$('.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 ..
});
欄目列表
推薦內(nèi)容
熱點內(nèi)容
展開
青田县| 安龙县| 牡丹江市| 翼城县| 东乡族自治县| 邯郸市| 澜沧| 南昌市| 怀安县| 信宜市| 文安县| 曲阜市| 门头沟区| 涟水县| 黄陵县| 庆元县| 甘孜县| 峡江县| 布拖县| 农安县| 来安县| 讷河市| 阳城县| 休宁县| 清苑县| 章丘市| 玉田县| 千阳县| 剑川县| 宣化县| 东方市| 崇明县| 新沂市| 保靖县| 镇赉县| 宁南县| 和龙市| 东至县| 普陀区| 凌海市| 平乐县|