aboutsummaryrefslogtreecommitdiffstats
path: root/src/offset.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/offset.js')
-rw-r--r--src/offset.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/offset.js b/src/offset.js
index ca27ca5c7..65dab2bd2 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -121,12 +121,13 @@ jQuery.fn.extend( {
doc = elem.ownerDocument;
offsetParent = elem.offsetParent || doc.documentElement;
while ( offsetParent &&
- ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
+ offsetParent !== doc.documentElement &&
jQuery.css( offsetParent, "position" ) === "static" ) {
- offsetParent = offsetParent.parentNode;
+ offsetParent = offsetParent.offsetParent || doc.documentElement;
}
- if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
+ if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 &&
+ jQuery.css( offsetParent, "position" ) !== "static" ) {
// Incorporate borders into its offset, since they are outside its content origin
parentOffset = jQuery( offsetParent ).offset();