X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Foffset.js;h=9c43296fe617743688d0924c0e16af974a7c16b9;hb=ed51be16224d392ae0b539d7aa2db294973c624d;hp=6289ad29320be3c07e295fbffa80f8dfdada84c6;hpb=28ee5c692245e18bdedcc91372949ec8b784ee36;p=jquery.git diff --git a/src/offset.js b/src/offset.js index 6289ad2..9c43296 100644 --- a/src/offset.js +++ b/src/offset.js @@ -1,3 +1,6 @@ +// The Offset Method +// Originally By Brandon Aaron, part of the Dimension Plugin +// http://jquery.com/plugins/project/dimensions jQuery.fn.offset = function() { var left = 0, top = 0, elem = this[0], results; @@ -52,9 +55,9 @@ jQuery.fn.offset = function() { } // Get parent scroll offsets - while ( parent.tagName && /^body|html$/i.test(parent.tagName) ) { + while ( parent.tagName && !/^body|html$/i.test(parent.tagName) ) { // Work around opera inline/table scrollLeft/Top bug - if ( /^inline|table-row.*$/i.test(jQuery.css(parent, "display")) ) + if ( !/^inline|table-row.*$/i.test(jQuery.css(parent, "display")) ) // Subtract parent scroll offsets add( -parent.scrollLeft, -parent.scrollTop ); @@ -67,7 +70,7 @@ jQuery.fn.offset = function() { } // Safari doubles body offsets with an absolutely positioned element or parent - if ( safari && absolute ) + if ( safari2 && absolute ) add( -doc.body.offsetLeft, -doc.body.offsetTop ); }