亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jquery滾動(dòng)條插件slimScroll使用方法

 更新時(shí)間:2017年02月09日 10:13:00   作者:qq_16399991  
這篇文章主要為大家詳細(xì)介紹了jquery滾動(dòng)條插件slimScroll的使用方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家總結(jié)了滾動(dòng)條插件slimScroll的使用方法,供大家參考,具體內(nèi)容如下

simScroll插件項(xiàng)目下載地址:https://github.com/rochal/jQuery-slimScroll

TIP:

1.slimScroll在使用的時(shí)候要依賴JQ,所以首次使用的時(shí)候要引入JQ再引入simScroll插件
2.不支持resize的時(shí)候重新調(diào)用插件,不過(guò)有人已經(jīng)修改過(guò)源碼,這是修改過(guò)的版本的下載地址:https://github.com/kujian/jQuery-slimScroll

resize重新調(diào)用插件增加的代碼部分:

function setScroll(){
 $(".box-list").slimScroll({
  height: boxHeight,
  alwaysVisible: true,
 });
}

setScroll();

$(window).on("resize",setScroll);

插件的調(diào)用以及參數(shù)設(shè)置:

$(function() {
 $(".slimscroll").slimScroll({
  width: 'auto', //可滾動(dòng)區(qū)域?qū)挾?
  height: '100%', //可滾動(dòng)區(qū)域高度
  size: '10px', //組件寬度
  color: '#000', //滾動(dòng)條顏色
  position: 'right', //組件位置:left/right
  distance: '0px', //組件與側(cè)邊之間的距離
  start: 'top', //默認(rèn)滾動(dòng)位置:top/bottom
  opacity: .4, //滾動(dòng)條透明度
  alwaysVisible: true, //是否 始終顯示組件
  disableFadeOut: false, //是否 鼠標(biāo)經(jīng)過(guò)可滾動(dòng)區(qū)域時(shí)顯示組件,離開(kāi)時(shí)隱藏組件
  railVisible: true, //是否 顯示軌道
  railColor: '#333', //軌道顏色
  railOpacity: .2, //軌道透明度
  railDraggable: true, //是否 滾動(dòng)條可拖動(dòng)
  railClass: 'slimScrollRail', //軌道div類名 
  barClass: 'slimScrollBar', //滾動(dòng)條div類名
  wrapperClass: 'slimScrollDiv', //外包div類名
  allowPageScroll: true, //是否 使用滾輪到達(dá)頂端/底端時(shí),滾動(dòng)窗口
  wheelStep: 20, //滾輪滾動(dòng)量
  touchScrollStep: 200, //滾動(dòng)量當(dāng)用戶使用手勢(shì)
  borderRadius: '7px', //滾動(dòng)條圓角
  railBorderRadius: '7px' //軌道圓角
 });
});

slimScroll事件——當(dāng)滾動(dòng)條達(dá)到父容器的頂部或底部觸發(fā)事件:

$(selector).slimScroll().bind('slimscroll', function(e, pos){
 console.log("Reached " + pos");
});

完整例子:

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>slimScroll插件使用例子</title>
</head>
<body>
 
 <div class="superDiv"> 
  <div id="innerDiv"> 
   <p>xxxxxxxxxxxxxx</p> 
  </div> 
 </div> 
 
 
 <script src="jquery.min.js"></script>
 <script src="jquery.slimscroll.js"></script>
 <script>
 
  $(function(){ 
   $('#innerDiv').slimScroll({ 
    height: '250px' 
   });
   
   $('#innerDiv').slimScroll().bind('slimscroll', function(e, pos){ 
    if(pos=='bottom'){
     // 執(zhí)行其他邏輯
    }
   }); 
  }); 
  
 </script>
</body>
</html>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論