Bug Tracker

Modify

Ticket #6395 (closed bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

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:1 Changed 3 years ago by snover

  • Milestone 1.4.3 deleted

Resetting milestone to future.

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.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.