gromo / jquery.scrollbar

jQuery CSS Customizable Scrollbar
GNU General Public License v2.0
756 stars 238 forks source link

How to control when scrollbar should appear #124

Closed pavlito closed 7 years ago

pavlito commented 7 years ago

Hi Gromo,

I am looking for an option, to control height.

I have panel which has some list items, and i want to activate scrollbar if height of panel is >600px, othervise it should not applied.

I am trying with fixed height, but problem occurs when that panel have small number of items or nothing at all, blank space remain because of height 600px

Any way to solve that.

gromo commented 7 years ago

Why not use max-height?

pavlito commented 7 years ago

I have tried that, but he calculates it own.

I tried with .scroll-content { max-height:600px !important; } and with

.scrollbar-inner { max-height:600px !important; }

But he calulates height of 557px?

gromo commented 7 years ago

Look at http://gromo.github.io/jquery.scrollbar/demo/basic.html - you can add/remove content by buttons and see that height is dynamic - it's limited by max-height

pavlito commented 7 years ago

So you set max height on .scroll-wrapper to be 250px. And scroll-content (his child element), have the same height, calculated by js.

I have the same logic on my page, where i set scroll-wrapper to have max-height: 600px, but my scroll-content have 557px also calculated by js

Scrollbar-wrapper image

Scroll-content image

gromo commented 7 years ago

do not touch scrollbar classes, use your own and set max-height to it

pavlito commented 7 years ago

Okay will do that. I have noticed that it is not setting properly scrollbar, probably because i use on that items also jquery plugin (chosen.js) for customizing inputs.

Any suggestions?

gromo commented 7 years ago

prepare example on jsFiddle.net with minimum JS/HTML/CSS required for reproducing this issue, and I will try to look at it in next few days

pavlito commented 7 years ago

Hi Gromo, i think the issue is fixed.