代码注释很全,可通过简单的修改样式来改变滚动条外观。
滚动条内容、滚动条、滚动滑块的样式类名
contentSelector: '.scroll_cont', //滚动内容区 barSelector: '.scroll_bar', //滚动条 sliderSelector: '.scroll_slider' //滚动滑块
如果想自己设定滚动条滑块高度,请将scrollBar.js内的
// 获取内容来定义滑块的高度
this._initSliderHeight();
// 根据内容来定义滑块的高度
_initSliderHeight: function() {
var rate = this.$cont.height()/this.$cont[0].scrollHeight;
var sliderHeight = rate*this.$bar.height();
this.$slider.css('height',sliderHeight);
},注释掉