Is there an event that I can access when the user zooms on a page? I’d like to fix the placement of an element when the user zooms.
<div id='a'> </div>
<div id='b'> </div>
<script type="text/javascript">
var right = $('#a').offset().right;
$('#a').css('right',right);
</script>
I’d place this code in the event for zooming.
You can attempt hacks to try to detect this, but in reality they don’t want developers to have access to this because you could just write code to defeat the purpose of the zoom. E.G. shrinking elements so they fit, even though a user is trying to enlarge the elements because they have bad eyesight, or something similar. This concept even applies for mobile devices, you cannot truly detect whether or not someone has pinch zoomed on an iphone, etc. The methods you will find include positioning elements and listening for changes, but this won’t help if the user is zoomed when the page loads, and even if they aren’t it still is not fool proof.
So short answer, no there is no window.zoom event similar to window.resize.