Consider border of scrollbar rails.

Fixes #176 https://github.com/noraesae/perfect-scrollbar/issues/176
This commit is contained in:
Karol Tomoki Yamazaki 2014-07-11 15:33:40 +02:00 committed by Hyunje Alex Jun
parent c6f2e6abd3
commit eb13d331d9
2 changed files with 6 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -102,7 +102,9 @@
isScrollbarYUsingRight = scrollbarYRight === scrollbarYRight, // !isNaN isScrollbarYUsingRight = scrollbarYRight === scrollbarYRight, // !isNaN
scrollbarYLeft = isScrollbarYUsingRight ? null: parseInt($scrollbarYRail.css('left'), 10), scrollbarYLeft = isScrollbarYUsingRight ? null: parseInt($scrollbarYRail.css('left'), 10),
isRtl = $this.css('direction') === "rtl", isRtl = $this.css('direction') === "rtl",
eventClassName = getEventClassName(); eventClassName = getEventClassName(),
railBorderXWidth = parseInt($scrollbarXRail.css('borderLeftWidth'), 10) + parseInt($scrollbarXRail.css('borderRightWidth'), 10),
railBorderYWidth = parseInt($scrollbarXRail.css('borderTopWidth'), 10) + parseInt($scrollbarXRail.css('borderBottomWidth'), 10);
var updateContentScrollTop = function (currentTop, deltaY) { var updateContentScrollTop = function (currentTop, deltaY) {
var newTop = currentTop + deltaY, var newTop = currentTop + deltaY,
@ -190,8 +192,8 @@
} }
$scrollbarYRail.css(scrollbarYStyles); $scrollbarYRail.css(scrollbarYStyles);
$scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth}); $scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth - railBorderXWidth});
$scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight}); $scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight - railBorderYWidth});
if (scrollbarXActive) { if (scrollbarXActive) {
$this.addClass('ps-active-x'); $this.addClass('ps-active-x');