Skip to main content

Bug Tracker

Side navigation

#6395 closed bug (worksforme)

Opened April 03, 2010 02:11PM UTC

Closed November 20, 2010 05:02AM UTC

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.

Attachments (0)
Change History (3)

Changed November 12, 2010 02:40AM UTC by snover comment:1

milestone: 1.4.3

Resetting milestone to future.

Changed November 19, 2010 04:45AM UTC by snover comment:2

owner: → 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.

Changed November 20, 2010 05:02AM UTC by addyosmani comment:3

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!