Side navigation
#6483 closed bug (worksforme)
Opened April 26, 2010 04:03AM UTC
Closed November 20, 2010 04:47AM UTC
Last modified February 23, 2011 03:20PM UTC
[v1.4.2]jQuery.fn.offset(newOffset) issue
Reported by: | david.yu | Owned by: | david.yu |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | dimensions | Version: | 1.4.2 |
Keywords: | offset | Cc: | |
Blocked by: | Blocking: |
Description
When current element has an "absolute" position, and offsetParent of this element is BODY, jQuery.curCSS( elem, "top", true ) maybe get "auto" in safari4/IE8, and curTop = parseInt( jQuery.curCSS( elem, "top", true ), 10 ) | | 0, will return 0, then props will lost really top and left pixel value of current element.
var props = { top: (options.top - curOffset.top) + curTop, left: (options.left - curOffset.left) + curLeft}
Attachments (0)
Change History (6)
Changed April 26, 2010 08:52AM UTC by comment:1
Changed June 15, 2010 01:30AM UTC by comment:2
component: | unfiled → dimensions |
---|
Changed October 29, 2010 04:53PM UTC by comment:3
owner: | → david.yu |
---|---|
priority: | → undecided |
status: | new → pending |
Please provide a reduced jsFiddle test case, thanks!
Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.
Changed November 01, 2010 06:40AM UTC by comment:4
using jquery-1.4.3.js in google chrome6:
setOffset method in version 1.4.3 is right now.
using jquery-1.4.2.js in google chrome6(FF is right):
setOffset method does not run as expected.
Changed November 20, 2010 04:47AM UTC by comment:5
_comment0: | As can be verified by looking at the above test case for jQuery 1.4.3 and the following test case [http://jsfiddle.net/addyosmani/kCC9A/5/ Live Test Case] for jQury 1.4.4, the offset behavior originally described seems to be working fine now. \ \ If there are any additional comments or test cases you would like to submit for us to investigate, please feel free to re-submit them and we'll take a look. \ \ Thanks! → 1290228524270565 |
---|---|
resolution: | → worksforme |
status: | pending → closed |
As can be verified by looking at the test case for jQuery 1.4.3 provided above and the following test case Live Test Case for jQury 1.4.4, the offset behavior originally described seems to be working fine now.
If there are any additional comments or test cases you would like to submit for us to investigate, please feel free to re-submit them and we'll take a look.
Thanks!
Changed February 23, 2011 03:20PM UTC by comment:6
The above fix works in 1.4.2 but not in the latest releases
var props = {
top: (options.top - curOffset.top) + curTop,
left: (options.left - curOffset.left) + curLeft
};
// add below line to fix this issue.
if (jQuery.nodeName(curElem.offsetParent()[0], 'body') && curElem.css('position') === 'absolute') {
props = {top: options.top, left: options.left};
}