@@ 10796-10834 (lines=39) @@ | ||
10793 | }; |
|
10794 | }, |
|
10795 | ||
10796 | position: function() { |
|
10797 | if ( !this[ 0 ] ) { |
|
10798 | return; |
|
10799 | } |
|
10800 | ||
10801 | var offsetParent, offset, |
|
10802 | parentOffset = { top: 0, left: 0 }, |
|
10803 | elem = this[ 0 ]; |
|
10804 | ||
10805 | // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, |
|
10806 | // because it is its only offset parent |
|
10807 | if ( jQuery.css( elem, "position" ) === "fixed" ) { |
|
10808 | ||
10809 | // we assume that getBoundingClientRect is available when computed position is fixed |
|
10810 | offset = elem.getBoundingClientRect(); |
|
10811 | } else { |
|
10812 | ||
10813 | // Get *real* offsetParent |
|
10814 | offsetParent = this.offsetParent(); |
|
10815 | ||
10816 | // Get correct offsets |
|
10817 | offset = this.offset(); |
|
10818 | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { |
|
10819 | parentOffset = offsetParent.offset(); |
|
10820 | } |
|
10821 | ||
10822 | // Add offsetParent borders |
|
10823 | parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); |
|
10824 | parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); |
|
10825 | } |
|
10826 | ||
10827 | // Subtract parent offsets and element margins |
|
10828 | // note: when an element has margin: auto the offsetLeft and marginLeft |
|
10829 | // are the same in Safari causing offset.left to incorrectly be 0 |
|
10830 | return { |
|
10831 | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
|
10832 | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
|
10833 | }; |
|
10834 | }, |
|
10835 | ||
10836 | offsetParent: function() { |
|
10837 | return this.map( function() { |
@@ 9597-9634 (lines=38) @@ | ||
9594 | }; |
|
9595 | }, |
|
9596 | ||
9597 | position: function() { |
|
9598 | if ( !this[ 0 ] ) { |
|
9599 | return; |
|
9600 | } |
|
9601 | ||
9602 | var offsetParent, offset, |
|
9603 | elem = this[ 0 ], |
|
9604 | parentOffset = { top: 0, left: 0 }; |
|
9605 | ||
9606 | // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, |
|
9607 | // because it is its only offset parent |
|
9608 | if ( jQuery.css( elem, "position" ) === "fixed" ) { |
|
9609 | ||
9610 | // Assume getBoundingClientRect is there when computed position is fixed |
|
9611 | offset = elem.getBoundingClientRect(); |
|
9612 | ||
9613 | } else { |
|
9614 | ||
9615 | // Get *real* offsetParent |
|
9616 | offsetParent = this.offsetParent(); |
|
9617 | ||
9618 | // Get correct offsets |
|
9619 | offset = this.offset(); |
|
9620 | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { |
|
9621 | parentOffset = offsetParent.offset(); |
|
9622 | } |
|
9623 | ||
9624 | // Add offsetParent borders |
|
9625 | parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); |
|
9626 | parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); |
|
9627 | } |
|
9628 | ||
9629 | // Subtract parent offsets and element margins |
|
9630 | return { |
|
9631 | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
|
9632 | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
|
9633 | }; |
|
9634 | }, |
|
9635 | ||
9636 | // This method will return documentElement in the following cases: |
|
9637 | // 1) For the element inside the iframe without offsetParent, this method will return |
@@ 8991-9025 (lines=35) @@ | ||
8988 | }; |
|
8989 | }, |
|
8990 | ||
8991 | position: function() { |
|
8992 | if ( !this[ 0 ] ) { |
|
8993 | return; |
|
8994 | } |
|
8995 | ||
8996 | var offsetParent, offset, |
|
8997 | elem = this[ 0 ], |
|
8998 | parentOffset = { top: 0, left: 0 }; |
|
8999 | ||
9000 | // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent |
|
9001 | if ( jQuery.css( elem, "position" ) === "fixed" ) { |
|
9002 | // We assume that getBoundingClientRect is available when computed position is fixed |
|
9003 | offset = elem.getBoundingClientRect(); |
|
9004 | ||
9005 | } else { |
|
9006 | // Get *real* offsetParent |
|
9007 | offsetParent = this.offsetParent(); |
|
9008 | ||
9009 | // Get correct offsets |
|
9010 | offset = this.offset(); |
|
9011 | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { |
|
9012 | parentOffset = offsetParent.offset(); |
|
9013 | } |
|
9014 | ||
9015 | // Add offsetParent borders |
|
9016 | parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); |
|
9017 | parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); |
|
9018 | } |
|
9019 | ||
9020 | // Subtract parent offsets and element margins |
|
9021 | return { |
|
9022 | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
|
9023 | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
|
9024 | }; |
|
9025 | }, |
|
9026 | ||
9027 | offsetParent: function() { |
|
9028 | return this.map(function() { |