I am trying to style my jScrollPane
but I find that my scroll bar is extending out of the container

How can I fix it? Code can be seen in http://jsfiddle.net/Mfest/
The recommended solution is to use the .jspCap to add space above or below the track rather than padding or borders. I've implemented this here:
http://jsfiddle.net/Mfest/6/
Note that I set the top and bottom caps to different sizes to make things appear to line up equally - I think that the rounded corners/ borders may be confusing the jScrollPane calculations a little bit.
Another demo of the caps in action: http://jscrollpane.kelvinluck.com/caps.html
I don't know the "proper jScrollPane method", but this does work in modern browsers.
The problem is that the padding and border on .jspTrack is adding up to make the height of the scrollbar 306px, instead of 300px.
So, you can use the box-sizing property on .jspTrack:
/* https://developer.mozilla.org/en/CSS/box-sizing */
width: 12px; /* adjust width */
/* support Firefox, Safari/WebKit, Opera and IE8 */
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
See: http://jsfiddle.net/Mfest/2/
I would personally not be satisfied with this answer, because it seems a kludgy way to fix it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With