0712-2888027 189-8648-0214
微信公眾號(hào)

孝感風(fēng)信網(wǎng)絡(luò)科技有限公司微信公眾號(hào)

當(dāng)前位置:主頁(yè) > 技術(shù)支持 > Javascript/JQuery > Infinite Scroll無(wú)限滾動(dòng)加截?cái)?shù)據(jù)插件

Infinite Scroll無(wú)限滾動(dòng)加截?cái)?shù)據(jù)插件

時(shí)間:2024-09-20來(lái)源:風(fēng)信官網(wǎng) 點(diǎn)擊: 919次
無(wú)限滾動(dòng)(Infinite Scroll)也稱為自動(dòng)分頁(yè)、滾動(dòng)分頁(yè)和無(wú)限分頁(yè)。常用在圖片、文章或其它列表形式的網(wǎng)頁(yè)中,用來(lái)在滾動(dòng)網(wǎng)頁(yè)的時(shí)候自動(dòng)加載下一頁(yè)的內(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});
 
選項(xiàng):
 
$('.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)部滾動(dòng)示例:
 
$('.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 ..
});

您可能感興趣的相關(guān)文章:

欄目列表
推薦內(nèi)容
熱點(diǎn)內(nèi)容
展開(kāi)