Bug Tracker

Opened 10 years ago

Closed 9 years ago

#6395 closed bug (worksforme)

offset().left doesn't work properly in Opera

Reported by: abnuk Owned by: abnuk
Priority: undecided Milestone:
Component: manipulation Version: 1.4.2
Keywords: opera, offset Cc:
Blocked by: Blocking:

Description

The left position of a div is calculated improperly in Opera 10.51. Extract from the console:

$j('#id').offset().left

1307

$j('#id')[0].offsetLeft

1197

offset().top is fine. Verified with both 1.3.2 and 1.4.2 versions.

Change History (3)

comment:1 Changed 9 years ago by snover

Milestone: 1.4.3

Resetting milestone to future.

comment:2 Changed 9 years ago by snover

Owner: set to abnuk
Priority: undecided
Status: newpending

Thanks for the report, but I am not sure this is a jQuery bug. $.fn.offset is relative to the document, whereas offsetLeft is relative to the nearest offsetParent. If this is still an issue in the latest version of Opera, please provide a test case demonstrating the issue.

comment:3 Changed 9 years ago by addyosmani

Resolution: worksforme
Status: pendingclosed

Testing offset().left and [0].offsetLeft across the latest versions of Opera, Chrome, Safari and FireFox I am consistently seeing the same expected values output when reproducing your test case. Please see here Live Test Case. As snover correctly points out, both offset and offsetLeft are relative to different things and so I would recommend re-reading the documentation on both to see how they should be correctly used. Thanks!

Note: See TracTickets for help on using tickets.