Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

jspVerticalBar class' paddings/margins not being taken into account in verticalTrackHeight #91

Open
wants to merge 2 commits into from

2 participants

@rickihastings

I came across this "issue" when designing a scrollbar, I've attached a screenshot to show my problem, I've made the background red so it's easily noticeable:

http://i.imgur.com/I1ReC.png

As you can see ".jspVerticalBar" has a margin on it which is displayed by the white gap at the top of the scroll bar, this is fine however the size of the vertical bar is relevant to the space it has, NOT including any paddings/margin. Because of this the bottom gets cut off.

This change subtracts the outerHeight (which includes padding/margins) from the available container height, then minuses the remaining height from paneHeight when setting verticalTrackHeight. I tried many CSS tricks with no success before applying a patch.

rickihastings added some commits
@rickihastings rickihastings Fix an issue where if padding/margin is added to .jspVerticalBar part…
… of it gets cut off
f1e064f
@rickihastings rickihastings Turns out comparing the outerHeight with the container.height() doesn…
…'t always generate the right amount (as I found through a bug in something I'm developing) so I've made further changes.
5328347
@balexandre

@n0valyfe You are missing the border part as well.

for border handling, this is enough: https://gist.github.com/1555032

the first line if (isScrollableV) { is found on line 439 of version 2.0.0beta11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 22, 2011
  1. @rickihastings
Commits on Aug 26, 2011
  1. @rickihastings

    Turns out comparing the outerHeight with the container.height() doesn…

    rickihastings authored
    …'t always generate the right amount (as I found through a bug in something I'm developing) so I've made further changes.
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 script/jquery.jscrollpane.js
View
8 script/jquery.jscrollpane.js
@@ -272,7 +272,13 @@
appendArrows(verticalTrack, settings.verticalArrowPositions, arrowUp, arrowDown);
}
- verticalTrackHeight = paneHeight;
+ var paddingTop = parseInt($('.jspVerticalBar').css('padding-top'), 10),
+ paddingBtm = parseInt($('.jspVerticalBar').css('padding-bottom'), 10),
+ marginTop = parseInt($('.jspVerticalBar').css('margin-top'), 10),
+ marginBtm = parseInt($('.jspVerticalBar').css('margin-bottom'), 10);
+
+ heightDifference = (paddingTop + paddingBtm) + (marginTop + marginBtm);
+ verticalTrackHeight = paneHeight - heightDifference;
container.find('>.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow').each(
function()
{
Something went wrong with that request. Please try again.