From 6c9fda19070de685ebbbe71dd2128fe28f13f6ee Mon Sep 17 00:00:00 2001 From: gonchuki Date: Thu, 9 Sep 2010 11:08:41 -0300 Subject: [PATCH] fix #952 and #637. getScrolls was adding the element's own scroll and getOffsets was overcompensating for the error --- Source/Element/Element.Dimensions.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/Element/Element.Dimensions.js b/Source/Element/Element.Dimensions.js index c9670b7df..a571cafd9 100644 --- a/Source/Element/Element.Dimensions.js +++ b/Source/Element/Element.Dimensions.js @@ -48,7 +48,7 @@ Element.implement({ }, getScrolls: function(){ - var element = this, position = {x: 0, y: 0}; + var element = this.parentNode, position = {x: 0, y: 0}; while (element && !isBody(element)){ position.x += element.scrollLeft; position.y += element.scrollTop; @@ -73,12 +73,11 @@ Element.implement({ html = document.id(this.getDocument().documentElement), htmlScroll = html.getScroll(), elemScrolls = this.getScrolls(), - elemScroll = this.getScroll(), isFixed = (styleString(this, 'position') == 'fixed'); return { - x: bound.left.toInt() + elemScrolls.x - elemScroll.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft, - y: bound.top.toInt() + elemScrolls.y - elemScroll.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop + x: bound.left.toInt() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft, + y: bound.top.toInt() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop }; }