Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 6 years ago

#4993 closed bug (worksforme)

offset() and position() return wrong values in Chrome when page is zoomed

Reported by: gkertesz Owned by: brandon
Priority: major Milestone:
Component: offset Version: 1.3.2
Keywords: chrome zoom Cc:
Blocked by: Blocking:

Description

offset() and position() return true pixel values in Google Chrome at all page zoom levels.

In contrast, in FF, IE and Opera they return values compensated for the actual page zoom.

Attachments (1)

zoom.html (732 bytes) - added by gkertesz 10 years ago.

Download all attachments as: .zip

Change History (14)

Changed 10 years ago by gkertesz

Attachment: zoom.html added

comment:1 Changed 10 years ago by jaffathecake

This is because getBoundingClientRect is buggy in webkit (same issue exists in Safari 4). I'm guessing it's returning the rect after the zoom has been applied.

To fix the issue, avoid getBoundingClientRect in webkit.

Cheers, Jake.

comment:2 Changed 10 years ago by jaffathecake

Looks like they've fixed the issue in webkit https://bugs.webkit.org/show_bug.cgi?id=25750

comment:3 Changed 9 years ago by snover

Resolution: worksforme
Status: newclosed

This should be fixed in all currently support versions of Chrome (7+). Please reopen if this is not the case.

comment:4 Changed 7 years ago by danboy19@…

In 2012, this seems to be broken again. I'm using jquery ui autocomplete in Chrome 17:

http://stackoverflow.com/questions/3638688/jqueryui-autocomplete-suggestions-misplaced-in-chrome

comment:5 Changed 7 years ago by anonymous

I am experiencing this issue as well, I've upgraded to latest versions of jquery but it hasn't made a difference

comment:6 Changed 7 years ago by anonymous

I am experiencing this issue too using:

 $(selector).animate({left: '-=' + value}, 200)

does not return the correct 'left' value when zoomed but the code:

 $(selector).css('left')

does return the correct value.

comment:7 Changed 7 years ago by anonymous

Here is the Fiddle for the example above

http://jsfiddle.net/sFYjc/2/

comment:8 Changed 7 years ago by anonymous

Comment 7 pretty much sums up the problems that I've been having with even the latest versions of jQuery. The behavior is slightly different but just as problematic when zoomed out. I've noticed that browsers using the Webkit engine are affected, and IE and Firefox have no such issues.

comment:9 Changed 7 years ago by anonymous

I am experiencing this problem too - with Chrome version 23.

Same as comment 6 & 7

http://jsfiddle.net/sFYjc/2/

comment:10 Changed 7 years ago by anonymous

comment:11 Changed 7 years ago by mikesherov

Adam, thanks for filing the WebKit bug. You have a typo in the title: getComputerdStyle.

comment:13 Changed 6 years ago by romanbolzern@…

Here's one for .css('left') I happened to stumble accross.. well, guess I'm waiting for it to be fixed. http://jsfiddle.net/RaznH/1/

Note: See TracTickets for help on using tickets.