Ticket #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: | |
| Blocking: | Blocked by: |
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
comment:2 Changed 3 years ago by snover
- Owner set to abnuk
- Priority set to undecided
- Status changed from new to pending
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 3 years ago by addyosmani
- Status changed from pending to closed
- Resolution set to worksforme
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!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Resetting milestone to future.