0

See my example here: http://codepen.io/comatory/pen/EyBKNv

When I collapse the page, the container moves and gives me updated value of offset().top however when I zoom in using my keyboard with CMD and +, it changes slightly at 90% but it stays the same more or less.

Can anyone explain this behaviour?

user3056783
  • 1,723
  • 1
  • 22
  • 44

1 Answers1

2

It's expected behavior of browsers. Quoting from http://api.jquery.com/offset/

... Also, dimensions may be incorrect when the page is zoomed by the user; browsers do not expose an API to detect this condition.

I dont know, but it will be very hard to make a script, which will solve that. However, to catch zoom events, you can look through:
- Catch browser's "zoom" event in JavaScript
- How to detect page zoom level in all modern browsers?
- https://gist.github.com/kevingessner/5598913

T.Todua
  • 49,021
  • 18
  • 212
  • 206