fullPage.js的方法:
1. moveSectionUp()
功能:向上滾動一頁。
2. moveSectionDown()
功能:向下滾動一頁。
3. moveTo(section, slide)
功能:滾動到第幾頁的第幾個幻燈片。
注意:頁面是從1開始,幻燈片是從0開始。
4. silentMoveTo(section, slide)
功能:滾動到第幾頁的第幾個幻燈片,但是沒有動畫效果。
5. moveSlideRight()
功能:幻燈片向右滾動。
6. moveSlideLeft()
功能:幻燈片向左滾動。
7. setAutoScrolling(boolean)
功能:動態設置autoScrolling。
8. setLockAnchors(boolean)
功能:動態設置lockAnchors。
9. setRecordHistory(boolean)
功能:動態設置recordHistory。
10. setScrollomgSpeed(milliseconds)
功能:動態設置scrollingSpeed。
11. setAllowScrolling(boolean,[directions])
功能:添加或者刪除鼠標滾輪/滑動控制。第一個參數true為啟用,false為禁用。
后面的參數為方向,取值包含all, up, down, left, right,可以使用多個,逗號隔開。
fullPage.js的回調函數:
1. afterLoad(anchorLink, index)
功能:滾動到某一section,並且滾動結束后,會觸發一次回調函數,函數接收anchorLink和index兩個參數,anchorLink是錨鏈接的名稱,index是序號,從1開始 計算。
例如:
afterLoad:function(anchorLink, index){ console.log("anchorLink:"+anchorLink+"\t index:"+index); },
- 1
- 2
- 3
2. onLeave(index, nextIndex,direction)
功能:在離開一個section時,會觸發一次調回函數,接收index、nextIndex和direction 三個參數。
index是離開頁面的序列號,從1開始算起;
nextIndex是滾動到目標頁面的序列號,從1開始算起。
direction是判斷向上還是向下滾動,值為up或down。
例如:
onLeave:function(index,nextIndex,direction){ console.log("index:"+index+" nextIndex:"+nextIndex+" direction:"+direction); },
- 1
- 2
- 3
3. afterRender()
功能:頁面結構生成后的回調函數,或者說是頁面初始化完成后的回調函數。
例子:
afterRender:function(){ console.log("afterRender"); },
- 1
- 2
- 3
4. afterResize()
功能:瀏覽器窗口尺寸改變后的回調函數。
例子:
afterResize:function(){ console.log("afterResize"); },
- 1
- 2
5. afterSlideLoad(anchorLink, index, slideAnchor, slideIndex)
功能:滾動到某一幻燈片后的回調函數,與afterLoad類似。slideAnchor、slideIndex起始值為0。
例子:
afterSlideLoad:function(anchorLink, index, slideAnchor, slideIndex){ console.log("anchorLink:" + anchorLink +" index:" + index +" slideAnchor:" + slideAnchor +" slideIndex:" + slideIndex ); },
- 1
- 2
- 3
6. onSlideLeave(anchorLink, index, slideAnchor, direction, slideIndex)
功能:在離開一個slide時,會觸發一次的回調函數,與onLeave類似。direction的值為left或者right。slideAnchor、slideIndex起始值為0。
例子:
onSlideLeave:function(anchorLink, index, slideAnchor, direction, slideIndex){ console.log("anchorLink:" + anchorLink +" index:" + index +" slideAnchor:" + slideAnchor +" direction:" + direction +" slideIndex:" + slideIndex ); },