mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 17:14:58 -05:00
Offset: account for scroll when calculating position
Fixes gh-1708 Close gh-1714
This commit is contained in:
committed by
Timmy Willison
parent
c252c5fac2
commit
2d715940b9
@@ -131,8 +131,11 @@ jQuery.fn.extend({
|
||||
}
|
||||
|
||||
// Add offsetParent borders
|
||||
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
|
||||
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
|
||||
// Subtract offsetParent scroll positions
|
||||
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ) -
|
||||
offsetParent.scrollTop();
|
||||
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) -
|
||||
offsetParent.scrollLeft();
|
||||
}
|
||||
|
||||
// Subtract parent offsets and element margins
|
||||
|
||||
Reference in New Issue
Block a user