1

我正在使用 rochal 的 jQuery 插件slimScroll来显示自定义滚动条。有没有办法让滚动条的高度固定,而不是自动生成?我认为wheelStep必须生成该值,但不知道要更改什么。所以,问题是如何制作一个固定大小的滚动条。

如果这是不可能的,我也可以使用另一个插件。

4

2 回答 2

4

这是可能的!为此,请执行以下操作:

后:

// sets border radius of the rail
railBorderRadius : '7px'

在 '7px' 后添加逗号和:

// Use a fixed height for the scroll bar
useFixedHeight : true,

// the fixed height of the scroll bar
fixedHeight : 50

代替:

barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);

和:

if( o.useFixedHeight )
    barHeight = o.fixedHeight;
else
    barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);
于 2013-12-10T11:32:29.300 回答
1

我尝试了一个简单的技巧..

首先添加一个类到滚动条,默认是'slimScrollBar'

barClass : 'slimScrollBar_new'

<script>
    $('#scroll-content').slimScroll({
        size : '3px',
        alwaysVisible: true,
        barClass : 'slimScrollBar_new'
    });
</script>

<style>
  .slimScrollBar_new{
      height: 100px !important;
   }
</style>
于 2017-09-05T06:45:03.983 回答