JavaScript - Zoom

javascript-dom

http://stackoverflow.com/questions/6163174/detect-page-zoom-change-with-jquery-in-safari
http://stackoverflow.com/questions/10276781/detect-user-zoom-on-mobile-device
http://stackoverflow.com/questions/20410108/detect-browser-zoom-level
https://www.npmjs.org/package/detect-zoom
http://blog.sebastian-martens.de/2009/12/how-to-detect-the-browser-zoom-level-change-browser-zoo/
http://tombigel.github.io/detect-zoom/
http://htmldoodads.appspot.com/zoom-level.html
http://bytes.com/topic/javascript/answers/709157-how-detect-browser-zoom-event
http://mlntn.com/2008/12/11/javascript-jquery-zoom-event-plugin/

How can we detect user zooming?

var zoom = document.documentElement.clientWidth / window.innerWidth;
ratio = document.width / window.innerWidth

How can we determine the current zoom level?

Reading out the zoom level directly is not possible, but you can get it by dividing screen.width by window.innerWidth if both properties are supported. Fortunately the zoom level is not important. What we need to know is how many CSS pixels currently fit on the screen, and we can get that information from window.innerWidth if it is supported.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License