Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make perfect scrollbar visible by default

I am using perfect scrollbar for custom scroll bar. It is working fine.

But the scrollbar is visible only when you mouse over on the container.

How do I make this visible all the time?

$('.container').perfectScrollbar();

Demo

like image 728
user6725932 Avatar asked Dec 23 '22 23:12

user6725932


1 Answers

From the perfectscrollbar wiki:

How can I make the scrollbars always visible?

The reason why it's hidden by default is that opacity: 0 is used. Please change all references of it to opacity: 0.6. If using .scss, modify the line @include opacity(0) to @include opacity(0.6) in the scrollbar-rail-default mixin and run gulp build to build .css and .min.css files.

If you're not willing to modify the CSS files but would like to make it always visible, please add following lines anywhere after perfect-scrollbar.css is loaded.

.ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail { opacity: 0.6; }

Also, an example code may be helpful to see how to achieve it.

Here is example https://github.com/noraesae/perfect-scrollbar/blob/master/examples/always-visible.html

So, if you modify your JSFiddle by pasting the following into your html, it works.

<div class="container">
  <div class="content"></div>
</div>

<style>
    .ps-container > .ps-scrollbar-x-rail,
    .ps-container > .ps-scrollbar-y-rail {   opacity: 0.6; }
 </style>
like image 179
Vanquished Wombat Avatar answered Jan 02 '23 04:01

Vanquished Wombat