2

I'm testing the following for the latest Chrome browser only (need it for my Chrome Extension.)

I was relying on jQuery to get me offsets of DOM elements and their height using the offset(), outerHeight() and other methods.

This works fine except when the tab/page is zoomed up or down. For some reason those methods return the same values as if no zooming was done.

Do I need to use other functions to account for the page zoom?

c00000fd
  • 20,994
  • 29
  • 177
  • 400
  • Include all the code you are using. Otherwise it is not hard to find your error. I guess you are assigning the values to a global variable. – iamawebgeek Sep 18 '14 at 08:56
  • jQuery docs: _"Also, dimensions may be incorrect when the page is zoomed by the user; browsers do not expose an API to detect this condition."_ – Xan Sep 18 '14 at 09:58
  • There are methods coming to extension APIs to get zoom information, but the milestone is Chrome 38. – Xan Sep 18 '14 at 10:02
  • @Xan: Yeah, I'm surprised that nether Chrome nor jQuery had any means of determining page zoom. What worked for me though was to get zoom using this method/hack and then multiply/divide the results returned by jQuery functions: http://stackoverflow.com/a/16091319/843732 – c00000fd Sep 18 '14 at 20:48

0 Answers0