簡體   English   中英

固定高度的jQuery slimScroll滾動條

[英]jQuery slimScroll scroll bar with fixed height

我正在使用rochal的jQuery插件slimScroll顯示自定義滾動條。 有沒有辦法使滾動條的高度固定,而不是自動生成? 我認為必須生成wheelStep值,但不知道要更改什么。 因此,問題是如何制作固定大小的滾動條。

如果這不可能,我也可以使用其他插件。

有可能! 為此,請執行以下操作:

后:

// 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);

我嘗試了一個簡單的技巧。

首先將一個類添加到滾動條,默認情況下為“ slimScrollBar”

barClass:'slimScrollBar_new'

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

<style>
  .slimScrollBar_new{
      height: 100px !important;
   }
</style>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM