欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中Nicescroll滾動(dòng)條插件的用法

 更新時(shí)間:2016年11月10日 10:26:03   作者:夜螟蛉  
本篇文章主要介紹了jQuery中Nicescroll滾動(dòng)條插件的用法,Nicescroll滾動(dòng)條插件是一個(gè)非常強(qiáng)大的基于jQuery的滾動(dòng)條插件,有需要的可以了解下。

本篇文章主要介紹了jQuery中Nicescroll滾動(dòng)條插件的用法,Nicescroll滾動(dòng)條插件是一個(gè)非常強(qiáng)大的基于jQuery的滾動(dòng)條插件,有需要的可以了解下。
Nicescroll滾動(dòng)條插件是一個(gè)非常強(qiáng)大的基于jQuery的滾動(dòng)條插件,不需要增加額外的css,幾乎全瀏覽器兼容。ie6+,實(shí)現(xiàn)只需要一段代碼,侵入性非常小,樣式可完全自定義,支持觸摸事件,可在觸摸屏上使用。

Nicescroll官網(wǎng)地址:http://www.areaaperta.com/nicescroll/

引入核心文件,插件需要引入1.5.X以上版本的jquery庫

最簡(jiǎn)單的用法如下:

$(document).ready(
 function() { 
  $("html").niceScroll();
 }
);

注意:一定要放在 $(document).ready 中進(jìn)行初始化!

隱藏滾動(dòng)條

$("#mydiv").getNiceScroll().hide();

檢測(cè)滾動(dòng)條是否重置大?。ó?dāng)窗口改變大小時(shí))

$("#mydiv").getNiceScroll().resize();

滾動(dòng)到某個(gè)位置

$("#mydiv").getNiceScroll(0).doScrollLeft(x, duration); // Scroll X Axis
$("#mydiv").getNiceScroll(0).doScrollTop(y, duration); // Scroll Y Axis

可增加各種參數(shù)

$(document).ready(
 function() { 
  $("#thisdiv").niceScroll({cursorcolor:"#00F"});
 }
);

配置參數(shù)表

$("#thisdiv").niceScroll({
    cursorcolor: "#424242", // 改變滾動(dòng)條顏色,使用16進(jìn)制顏色值
    cursoropacitymin: 0, // 當(dāng)滾動(dòng)條是隱藏狀態(tài)時(shí)改變透明度, 值范圍 1 到 0
    cursoropacitymax: 1, // 當(dāng)滾動(dòng)條是顯示狀態(tài)時(shí)改變透明度, 值范圍 1 到 0
    cursorwidth: "5px", // 滾動(dòng)條的寬度,單位:便素
    cursorborder: "1px solid #fff", // CSS方式定義滾動(dòng)條邊框
    cursorborderradius: "5px", // 滾動(dòng)條圓角(像素)
    zindex: "auto" | <number>, // 改變滾動(dòng)條的DIV的z-index值
    scrollspeed: 60, // 滾動(dòng)速度
    mousescrollstep: 40, // 鼠標(biāo)滾輪的滾動(dòng)速度 (像素)
    touchbehavior: false, // 激活拖拽滾動(dòng)
    hwacceleration: true, // 激活硬件加速
    boxzoom: false, // 激活放大box的內(nèi)容
    dblclickzoom: true, // (僅當(dāng) boxzoom=true時(shí)有效)雙擊box時(shí)放大
    gesturezoom: true, // (僅 boxzoom=true 和觸屏設(shè)備時(shí)有效) 激活變焦當(dāng)out/in(兩個(gè)手指外張或收縮)
    grabcursorenabled: true // (僅當(dāng) touchbehavior=true) 顯示“抓住”圖標(biāo)display "grab" icon
    autohidemode: true, // 隱藏滾動(dòng)條的方式, 可用的值: 
     true | // 無滾動(dòng)時(shí)隱藏
     "cursor" | // 隱藏
     false | // 不隱藏,
     "leave" | // 僅在指針離開內(nèi)容時(shí)隱藏
     "hidden" | // 一直隱藏
     "scroll", // 僅在滾動(dòng)時(shí)顯示    
    background: "", // 軌道的背景顏色
    iframeautoresize: true, // 在加載事件時(shí)自動(dòng)重置iframe大小
    cursorminheight: 32, // 設(shè)置滾動(dòng)條的最小高度 (像素)
    preservenativescrolling: true, // 你可以用鼠標(biāo)滾動(dòng)可滾動(dòng)區(qū)域的滾動(dòng)條和增加鼠標(biāo)滾輪事件
    railoffset: false, // 可以使用top/left來修正位置
    bouncescroll: false, // (only hw accell) 啟用滾動(dòng)跳躍的內(nèi)容移動(dòng)
    spacebarenabled: true, // 當(dāng)按下空格時(shí)使頁面向下滾動(dòng)
    railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, // 設(shè)置軌道的內(nèi)間距
    disableoutline: true, // 當(dāng)選中一個(gè)使用nicescroll的div時(shí),chrome瀏覽器中禁用outline
    horizrailenabled: true, // nicescroll可以管理水平滾動(dòng)
    railalign: right, // 對(duì)齊垂直軌道
    railvalign: bottom, // 對(duì)齊水平軌道
    enabletranslate3d: true, // nicescroll 可以使用CSS變型來滾動(dòng)內(nèi)容
    enablemousewheel: true, // nicescroll可以管理鼠標(biāo)滾輪事件
    enablekeyboard: true, // nicescroll可以管理鍵盤事件
    smoothscroll: true, // ease動(dòng)畫滾動(dòng)
    sensitiverail: true, // 單擊軌道產(chǎn)生滾動(dòng)
    enablemouselockapi: true, // 可以用鼠標(biāo)鎖定API標(biāo)題 (類似對(duì)象拖動(dòng))
    cursorfixedheight: false, // 修正光標(biāo)的高度(像素)
    hidecursordelay: 400, // 設(shè)置滾動(dòng)條淡出的延遲時(shí)間(毫秒)
    directionlockdeadzone: 6, // 設(shè)定死區(qū),為激活方向鎖定(像素)
    nativeparentscrolling: true, // 檢測(cè)內(nèi)容底部便于讓父級(jí)滾動(dòng)
    enablescrollonselection: true, // 當(dāng)選擇文本時(shí)激活內(nèi)容自動(dòng)滾動(dòng)
    cursordragspeed: 0.3, // 設(shè)置拖拽的速度
    rtlmode: "auto", // DIV的水平滾動(dòng)從左邊開始
    cursordragontouch: false, // 使用觸屏模式來實(shí)現(xiàn)拖拽
    oneaxismousemode: "auto", // 當(dāng)只有水平滾動(dòng)時(shí)可以用鼠標(biāo)滾輪來滾動(dòng),如果設(shè)為false則不支持水平滾動(dòng),如果設(shè)為auto支持雙軸滾動(dòng)
    scriptpath: "" // 為boxmode圖片自定義路徑 ("" => same script path)
    preventmultitouchscrolling: true // 防止多觸點(diǎn)事件引發(fā)滾動(dòng)
  });

另外注意:當(dāng)在同一頁面中使用多個(gè)nicescroll插件時(shí),要及時(shí)隱藏用完的nicescroll對(duì)象,加載時(shí),需要先show,再resize。

當(dāng)插件放在具有absolute浮動(dòng)的容器中,并設(shè)置了top值時(shí),插件的top會(huì)出現(xiàn)問題,解決方法使用插件的railoffset屬性:

railoffset, you can add offset top/left for rail position (default:false)

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

相關(guān)文章

最新評(píng)論