Catch browser's "zoom" event in JavaScript -


Is it possible to use JavaScript, when the user changes the zoom in the page? I just want to capture a "zoom" event and want to answer it (similar to window. Theorem event).

Thank you.

There is no way to actively detect how much zoom is. I got a good entry on how you can try to implement it.

I have found two ways to find the zoom level. One way to detect zoom level changes depends on the fact that percentage values ​​are not zoomed. One percent value is relative to the width of the viewport, and thus unaffected by page zoom. If you insert two elements, with one place in one pixel position and one place in another pixel, they will separate the page after zooming. Find the ratio between the positions of both the elements and you get the zoom level. See test case

You can also do this by using the above posting tool. The problem is whether you have more or less readings about whether you have been zoomed or not. This will work better in some browsers than the other.

There is no way to show that the page has zoomed in while zooming in or not.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -