Skip to content

Commit 522b92c

Browse files
committed
Offset: Ignore offset for statically positioned offset parent
1 parent 7885262 commit 522b92c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/offset.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,10 @@ jQuery.fn.extend( {
125125
offsetParent !== doc.documentElement &&
126126
jQuery.css( offsetParent, "position" ) === "static" ) {
127127

128-
offsetParent = offsetParent.offsetParent;
128+
offsetParent = offsetParent.offsetParent || doc.documentElement;
129129
}
130-
if ( offsetParent &&
131-
offsetParent !== doc.documentElement && offsetParent !== elem &&
132-
offsetParent.nodeType === 1 ) {
130+
if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 &&
131+
jQuery.css( offsetParent, "position" ) !== "static" ) {
133132

134133
// Incorporate borders into its offset, since they are outside its content origin
135134
parentOffset = jQuery( offsetParent ).offset();

0 commit comments

Comments
 (0)