buzinas / simple-scrollbar

Very simple and lightweight vanilla javascript library for creating a custom scrollbar cross-browser.
MIT License
575 stars 159 forks source link

Without scrollbar, div is stretched out #43

Closed BabyDead closed 5 years ago

BabyDead commented 6 years ago

So, I've noticed that when there's not enough content in a block to actually make it scrollable, the content is stretching on the width + 18px of the ss-content element.

It seems to work perfectly when there IS indeed a scrollbar, however.

I have no idea why it's caused as I can't really find any differences... But I hope this helps.

My6UoT9 commented 6 years ago

Just force the scrollbar with CSS: overflow-y:scroll

BabyDead commented 6 years ago

But I do not want the scrollbar when it's not nessecary

My6UoT9 commented 6 years ago

Wouldnt that be the simplest way to fix that problem? The scrollbar is invisible, and it cannot be used - since there is no scrollable area.

ReDreamport commented 6 years ago

Just to be clear: add overflow-y: scroll to .ss-content?

michaelspiss commented 6 years ago

Adding overflow-y: scroll; to .ss-content in the css fixes this problem. I just created pull request #49 which does exactly that.

Please keep in mind that you will also need to merge #37, else the width will still be off by some px in some browsers.