Always show Scrollbar in mcustomscrollbar plugin

4.5k Views Asked by At

I'm currently using mcustomscrollbar which is a jquery free plugin. Is there a possible way that this plug in should always show the scrollbar?

2

There are 2 best solutions below

1
Felix On

The scroll bar should be visible by default unless you're using autoHideScrollbar: true configuration

Besides that, you can also try using this css:

.mCustomScrollBox>.mCSB_scrollTools {
    opacity: 1 !important;
}
0
Yuval A. On

You might of meant that you want the scroll bar to always be visible, even when the scrollable area's content is less than the viewport part of the container. I reached this question when searching for an answer to this situation.

The answer is to add alwaysShowScrollbar to the configuration object of mCustomScrollbar.

From the documentation:

alwaysShowScrollbar: integer - Always keep scrollbar(s) visible, even when there’s nothing to scroll.

    alwaysShowScrollbar: 0 – disable (default)
    alwaysShowScrollbar: 1 – keep dragger rail visible
    alwaysShowScrollbar: 2 – keep all scrollbar components (dragger, rail, buttons etc.) visible