- // Get offsetParent's position
- position = jQuery.css(offsetParent, "position");
-
- // Safari <= 2 doubles body offsets with an absolutely positioned element or parent
- if ( safari2 && !absolute && position == "absolute" )
- absolute = true;
-
- // Opera adds border for fixed, relative and absolute parent elements
- if (opera && /^fixed|relative|absolute$/i.test(position))
- add(
- -parseInt(jQuery.css(elem, "borderLeftWidth")),
- -parseInt(jQuery.css(elem, "borderTopWidth"))
- );
-
- // Add the document scroll offsets if position is fixed
- if ( !fixed && position == "fixed" )
+ // Add the document scroll offsets if position is fixed on any offsetParent
+ if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" )