Search code examples
jquerycssjscrollpane

Need help styling jScrollPane


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/


Solution

  • My answer is now redundant, see the below answer.


    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.