In Internet Explorer 7 some properties (mouse coordinates) are treated as physical while others are logical (offset). This essentially required Web developers to be aware of or calculate the zoom state. In IE8 release all properties are logical.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Also, if you need to do check in IE 8, you can use window.screen.deviceXDPI and window.screen.deviceYDPI. The default is 96 dpi, and if you're zoomed, the number will be larger (aka 144 when zoomed 150%)
You can get it using:
Thanks a lot @niclasnorgren!
There is a small syntax error (body instead of document.body) on the accepted answer. This seems to do the trick also.
i have posted solution for this on another post you can get this here. which will work in IE7 also.
Auto-detect a screen resolution and change browser zoom with Javascript?
Demo