Search code examples
javascriptjqueryhtmlcssmcustomscrollbar

How to set the width of mCustomScrollbar using CSS


I am trying to increase the width of the scroll bar by setting width of .mCSB_dragger as described in the documentation. But the scrollbar width remains as is.

$('#container1').mCustomScrollbar({ 
        theme:"dark-3"        
});

$(document).on('click', '.participants li', function(e){
  
});
#container1 {
    height:200px;
    width:100px;
    padding:5px;
    border:1px solid black;
}

 .mCSB_dragger{
    width:25px;
 }
<link rel="stylesheet" href="//malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.min.css" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//malihu.github.io/custom-scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
<div id="container1">
  <p>1</p>
  <p>2</p>
  <p>3</p>
  <p>4</p>
  <p>5</p>
  <p>6</p>
  <p>6</p>
  <p>6</p>
</div>

Here is the code:


Solution

  • Try this one, I think it needs to be override but overriding is not a good practice. I hope this helps

    .mCSB_dragger_bar{
        width:13px!important;
     }
    

    and if you want the scroll knob to also adjust its width you may also override

    .mCSB_draggerRail{
        width:13px!important;
    }