@@ 9077-9106 (lines=30) @@ | ||
9074 | ||
9075 | jQuery.fn.extend({ |
|
9076 | ||
9077 | position: function() { |
|
9078 | if ( !this[0] ) { |
|
9079 | return null; |
|
9080 | } |
|
9081 | ||
9082 | var elem = this[0], |
|
9083 | ||
9084 | // Get *real* offsetParent |
|
9085 | offsetParent = this.offsetParent(), |
|
9086 | ||
9087 | // Get correct offsets |
|
9088 | offset = this.offset(), |
|
9089 | parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); |
|
9090 | ||
9091 | // Subtract element margins |
|
9092 | // note: when an element has margin: auto the offsetLeft and marginLeft |
|
9093 | // are the same in Safari causing offset.left to incorrectly be 0 |
|
9094 | offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; |
|
9095 | offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; |
|
9096 | ||
9097 | // Add offsetParent borders |
|
9098 | parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; |
|
9099 | parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; |
|
9100 | ||
9101 | // Subtract the two offsets |
|
9102 | return { |
|
9103 | top: offset.top - parentOffset.top, |
|
9104 | left: offset.left - parentOffset.left |
|
9105 | }; |
|
9106 | }, |
|
9107 | ||
9108 | offsetParent: function() { |
|
9109 | return this.map(function() { |
@@ 8019-8048 (lines=30) @@ | ||
8016 | ||
8017 | ||
8018 | jQuery.fn.extend({ |
|
8019 | position: function() { |
|
8020 | if ( !this[0] ) { |
|
8021 | return null; |
|
8022 | } |
|
8023 | ||
8024 | var elem = this[0], |
|
8025 | ||
8026 | // Get *real* offsetParent |
|
8027 | offsetParent = this.offsetParent(), |
|
8028 | ||
8029 | // Get correct offsets |
|
8030 | offset = this.offset(), |
|
8031 | parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); |
|
8032 | ||
8033 | // Subtract element margins |
|
8034 | // note: when an element has margin: auto the offsetLeft and marginLeft |
|
8035 | // are the same in Safari causing offset.left to incorrectly be 0 |
|
8036 | offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; |
|
8037 | offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; |
|
8038 | ||
8039 | // Add offsetParent borders |
|
8040 | parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; |
|
8041 | parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; |
|
8042 | ||
8043 | // Subtract the two offsets |
|
8044 | return { |
|
8045 | top: offset.top - parentOffset.top, |
|
8046 | left: offset.left - parentOffset.left |
|
8047 | }; |
|
8048 | }, |
|
8049 | ||
8050 | offsetParent: function() { |
|
8051 | return this.map(function() { |