jq全屏滾動插件fullpage.js使用方法及move.js

1、fullpage.js引用地址

 

fullpage.jscss

2、插件使用方法

<1>引入

1.插入jquery.fullPage.css;html

2.插入jquery.js;jquery

3.插入jquery-ui.js;(用於製做動畫)css3

4.插入jquery.fullpage.js;git

1     <link rel="stylesheet" href="jquery.fullPage.css"> 2 <script src="jquery-1.11.3.min.js"></script> 3 <script src="jquery-ui.js"></script> 4 <script src="jquery.fullPage.js"></script>

 <2>html

 1 <body>
 2     <div id="fullpage">
 3         <div class="section s1">
 4             <img src="img/bc8.jpg" alt="">
 5         </div>
 6         <div class="section s2">
 7             <img src="img/bc8.jpg" alt="">
 8         </div>
 9         <div class="section s3">
10             <img src="img/bc8.jpg" alt="">
11         </div>
12         <div class="section s4">
13             <img src="img/bc8.jpg" alt="">
14         </div>
15         <div class="section s5">
16             <img src="img/bc8.jpg" alt="">
17         </div>
18     </div>
19 </body>

<3>js

1 <script>
2         $(function(){
3             $('#fullpage').fullpage({
4                 navigation:'true'
5             });
6         });
7     </script>

<4>配置

a、選項

 

選項 類型 默認值 說明
verticalCentered 字符串 true 內容是否垂直居中
resize 布爾值 false 字體是否隨着窗口縮放而縮放
slidesColor 函數 設置背景顏色
anchors 數組 定義錨連接
scrollingSpeed 整數 700 滾動速度,單位爲毫秒
easing 字符串 easeInQuart 滾動動畫方式
menu 布爾值 false 綁定菜單,設定的相關屬性與 anchors 的值對應後,菜單能夠控制滾動
navigation 布爾值 false 是否顯示項目導航
navigationPosition 字符串 right 項目導航的位置,可選 left 或 right
navigationColor 字符串 #000 項目導航的顏色
navigationTooltips 數組 項目導航的 tip
slidesNavigation 布爾值 false 是否顯示左右滑塊的項目導航
slidesNavPosition 字符串 bottom 左右滑塊的項目導航的位置,可選 top 或 bottom
controlArrowColor 字符串 #fff 左右滑塊的箭頭的背景顏色
loopBottom 布爾值 false 滾動到最底部後是否滾回頂部
loopTop 布爾值 false 滾動到最頂部後是否滾底部
loopHorizontal 布爾值 true 左右滑塊是否循環滑動
autoScrolling 布爾值 true 是否使用插件的滾動方式,若是選擇 false,則會出現瀏覽器自帶的滾動條
scrollOverflow 布爾值 false 內容超過滿屏後是否顯示滾動條
css3 布爾值 false 是否使用 CSS3 transforms 滾動
paddingTop 字符串 0 與頂部的距離
paddingBottom 字符串 0 與底部距離
fixedElements 字符串  
normalScrollElements    
keyboardScrolling 布爾值 true 是否使用鍵盤方向鍵導航
touchSensitivity 整數 5  
continuousVertical 布爾值 false 是否循環滾動,與 loopTop 及 loopBottom 不兼容
animateAnchor 布爾值 true  
normalScrollElementTouchThreshold 整數 5  

 b、方法

 

名稱 說明
moveSectionUp() 向上滾動
moveSectionDown() 向下滾動
moveTo(section, slide) 滾動到
moveSlideRight() slide 向右滾動
moveSlideLeft() slide 向左滾動
setAutoScrolling() 設置頁面滾動方式,設置爲 true 時自動滾動
setAllowScrolling() 添加或刪除鼠標滾輪/觸控板控制
setKeyboardScrolling() 添加或刪除鍵盤方向鍵控制
setScrollingSpeed() 定義以毫秒爲單位的滾動速度

 c、回調函數

 

名稱 說明
afterLoad 滾動到某一屏後的回調函數,接收 anchorLink 和 index 兩個參數,anchorLink 是錨連接的名稱,index 是序號,從1開始計算
onLeave 滾動前的回調函數,接收 index、nextIndex 和 direction 3個參數:
index 是離開的「頁面」的序號,從1開始計算;
nextIndex 是滾動到的「頁面」的序號,從1開始計算;
direction 判斷往上滾動仍是往下滾動,值是 up 或 down。
afterRender 頁面結構生成後的回調函數,或者說頁面初始化完成後的回調函數
afterSlideLoad 滾動到某一水平滑塊後的回調函數,與 afterLoad 相似,接收 anchorLink、index、slideIndex、direction 4個參數
onSlideLeave 某一水平滑塊滾動前的回調函數,與 onLeave 相似,接收 anchorLink、index、slideIndex、direction 4個參數

 d、自定義高度

不少用戶留言說沒法自定義底部Footer的高度,我 也查閱了不少資料,都沒有發現方法,可是無心間看到一個Fullpage的示例,實現自定義底部高度的方法,並且是不算在滑動的Section裏面,在需 要自定義高度的DIV裏面,只須要給Section添加.fp-auto-height類就能夠實現自定義高度。github

3、move.js及使用方法

 

move.js數組

 

 

使用方法瀏覽器

相關文章
相關標籤/搜索