jQuery-slimScroll
jQuery-slimScroll copied to clipboard
Scrollbar is displayed in error if element has a border
Firstly I'd like to say that I think this plugin is excellent and, of the many plugins out there designed for this purpose, this is the one I've found the nicest to work with.
If I apply slimScroll to an element with a max-height
property set and the contents of that element is smaller in height than the max-height
value of its parent, the slimScroll scrollbar is not displayed. Once the contents' height exceeds the parent's max-height
value, the scrollbar is displayed. This is exactly as expected.
However, if the parent element has a border - for example border: 1px solid black
- the scrollbar is always displayed, even if the contents of the element are not taller than the parent's max-height
value and a scrollbar is not required.
I've created a fiddle to demonstrate the problem here. Note that the div
has an unnecessary scrollbar at all times, but that if you remove the border
property from its style
the scrollbar disappears and functions as normal (i.e. if you had more <li>
elements the scrollbar will be displayed as expected.