好处: 向下兼容ie6,基于jq,部署简单
坏处: 基于dom的操作,等待dom加载才能负值,动态引用,长文章操作比较有挑战性…
$("#thisdiv").niceScroll({
cursorcolor: "#424242", // change cursor color in hex
// 更改十六进制中的光标颜色
cursoropacitymin: 0, // change opacity when cursor is inactive (scrollabar "hidden" state), range from 1 to 0
//当光标处于非活动状态时更改不透明度(scrollabar“hidden”状态),范围从1到0
cursoropacitymax: 1, // change opacity when cursor is active (scrollabar "visible" state), range from 1 to 0
//在光标处于活动状态时更改不透明度(scrollabar“可见”状态),范围从1到0
cursorwidth: "5px", // cursor width in pixel (you can also write "5px")
//光标宽度(像素)(您也可以写入“5px”)
cursorborder: "1px solid #fff", // css definition for cursor border
//光标边框的css定义
cursorborderradius: "5px", // border radius in pixel for cursor
//光标的边框半径(以像素为单位)
zindex: "auto" | [number], // change z-index for scrollbar div
//更改滚动条div的z索引
scrollspeed: 60, // scrolling speed
//滚动速度
mousescrollstep: 40, // scrolling speed with mouse wheel (pixel)
//鼠标滚轮滚动速度(像素)
touchbehavior: false, // DEPRECATED!! use "emulatetouch"
//已弃用!!使用“emulatetouch”
emulatetouch: false, // enable cursor-drag scrolling like touch devices in desktop computer
//启用桌面计算机中类似触摸设备的光标拖动滚动
hwacceleration: true, // use hardware accelerated scroll when supported
//在支持时使用硬件加速滚动
boxzoom: false, // enable zoom for box content
//启用框内容缩放
dblclickzoom: true, // (only when boxzoom=true) zoom activated when double click on box
//(仅当boxzoom=true时)双击方框时缩放激活
gesturezoom: true, // (only when boxzoom=true and with touch devices) zoom activated when pinch out/in on box
//(仅当boxzoom=真且使用触摸设备时)在缩小/缩小框时激活缩放
grabcursorenabled: true // (only when touchbehavior=true) display "grab" icon
//(仅当touchbehavior=true时)显示“grab”图标
autohidemode: true, // how hide the scrollbar works, possible values: -----隐藏滚动条的工作方式,可能的值:
true | // hide when no scrolling-----不滚动时隐藏
"cursor" | // only cursor hidden-----仅隐藏光标
false | // do not hide,-----不隐藏
"leave" | // hide only if pointer leaves content-----仅当指针离开内容时隐藏
"hidden" | // hide always-----始终隐藏
"scroll", // show only on scroll-----仅在滚动上显示
background: "", // change css for rail background
//更改轨道背景的css
iframeautoresize: true, // autoresize iframe on load event
//加载时自动Resize iframe事件
cursorminheight: 32, // set the minimum cursor height (pixel)
//设置最小光标高度(像素)
preservenativescrolling: true, // you can scroll native scrollable areas with mouse, bubbling mouse wheel event
//您可以使用鼠标、冒泡鼠标滚轮事件滚动本机可滚动区域
railoffset: false, // you can add offset top/left for rail position
//可以为轨道位置添加上/左偏移
bouncescroll: false, // (only hw accell) enable scroll bouncing at the end of content as mobile-like
//(仅hw accell)启用内容末尾的滚动反弹,就像移动一样
spacebarenabled: true, // enable page down scrolling when space bar has pressed
//按下空格键时启用向下滚动页面
railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, // set padding for rail bar
//设置栏杆的填充
disableoutline: true, // for chrome browser, disable outline (orange highlight) when selecting a div with nicescroll
//对于chrome浏览器,使用NiceSoll选择div时禁用outline(橙色突出显示)
horizrailenabled: true, // nicescroll can manage horizontal scroll
//NiceSoll可以管理水平滚动
railalign: right, // alignment of vertical rail
//垂直轨道的对齐
railvalign: bottom, // alignment of horizontal rail
//水平轨道对齐
enabletranslate3d: true, // nicescroll can use css translate to scroll content
//NiceSoll可以使用css translate来滚动内容
enablemousewheel: true, // nicescroll can manage mouse wheel events
//NiceSoll可以管理鼠标滚轮事件
enablekeyboard: true, // nicescroll can manage keyboard events
//NiceSoll可以管理键盘事件
smoothscroll: true, // scroll with ease movement
//轻松滚动
sensitiverail: true, // click on rail make a scroll
//单击导轨进行滚动
enablemouselockapi: true, // can use mouse caption lock API (same issue on object dragging)
//可以使用鼠标标题锁定API(对象拖动上的问题相同)
cursorfixedheight: false, // set fixed height for cursor in pixel
//以像素为单位设置光标的固定高度
hidecursordelay: 400, // set the delay in microseconds to fading out scrollbars
//将以微秒为单位的延迟设置为淡出滚动条
directionlockdeadzone: 6, // dead zone in pixels for direction lock activation
//方向锁激活的死区(像素)
nativeparentscrolling: true, // detect bottom of content and let parent to scroll, as native scroll does
//检测内容的底部并让父级滚动,就像本机滚动一样
enablescrollonselection: true, // enable auto-scrolling of content when selection text
//在选择文本时启用内容的自动滚动
cursordragspeed: 0.3, // speed of selection when dragged with cursor
//使用光标拖动时的选择速度
rtlmode: "auto", // horizontal div scrolling starts at left side
//水平div滚动从左侧开始
cursordragontouch: false, // drag cursor in touch / touchbehavior mode also
//也在触摸/触摸行为模式下拖动光标
oneaxismousemode: "auto", // it permits horizontal scrolling with mousewheel on horizontal only content, if false (vertical-only) mousewheel don't scroll horizontally, if value is auto detects two-axis mouse
//它允许在仅水平内容上使用鼠标滚轮水平滚动,如果为false(仅垂直),鼠标滚轮不水平滚动,如果值为auto,则检测到两轴鼠标
scriptpath: "" // define custom path for boxmode icons ("" => same script path)
//定义boxmode图标的自定义路径(”=>相同的脚本路径)
preventmultitouchscrolling: true // prevent scrolling on multitouch events
//防止在多点触控事件上滚动
disablemutationobserver: false // force MutationObserver disabled,
//强制MutationObserver已禁用,
enableobserver: true // enable DOM changing observer, it tries to resize/hide/show when parent or content div had changed
//启用DOM更改观察器,它尝试在父级或内容div更改时调整大小/隐藏/显示
scrollbarid: false // set a custom ID for nicescroll bars
//为nicesroll条设置自定义ID
});