From f02f5e89b77e0061762785dcb3928b0e6a0d4f5e Mon Sep 17 00:00:00 2001 From: Hyunje Alex Jun Date: Sun, 16 Jun 2013 17:56:40 +0900 Subject: [PATCH] Fix ie6 scrollbar position problem. This patch is in fact contributed by the idea of @maoziliang. --- src/perfect-scrollbar.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/perfect-scrollbar.js b/src/perfect-scrollbar.js index 8706f09..835a31b 100644 --- a/src/perfect-scrollbar.js +++ b/src/perfect-scrollbar.js @@ -326,8 +326,29 @@ $scrollbarY.bind('mouseenter.perfect-scroll', mouseenter).bind('mouseleave.perfect-scroll', mouseleave); }; + var fixIe6ScrollbarPosition = function () { + updateScrollbarCss = function () { + $scrollbarX.css({left: scrollbarXLeft + $this.scrollLeft(), bottom: scrollbarXBottom, width: scrollbarXWidth}); + $scrollbarY.css({top: scrollbarYTop + $this.scrollTop(), right: scrollbarYRight, height: scrollbarYHeight}); + $scrollbarX.hide().show(); + $scrollbarY.hide().show(); + }; + updateContentScrollTop = function () { + var scrollTop = parseInt(scrollbarYTop * contentHeight / containerHeight, 10); + $this.scrollTop(scrollTop); + $scrollbarX.css({bottom: scrollbarXBottom}); + $scrollbarX.hide().show(); + }; + updateContentScrollLeft = function () { + var scrollLeft = parseInt(scrollbarXLeft * contentWidth / containerWidth, 10); + $this.scrollLeft(scrollLeft); + $scrollbarY.hide().show(); + }; + }; + if (version === 6) { bindHoverHandlers(); + fixIe6ScrollbarPosition(); } };