Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect zoom in/out event in iOS Safari?

We have necessity to do something before the web page is zoomed in or out in Safari on iOS. Is it possible?

There are two cases when interface is zoomed - when user does a zooming gesture and when user clicks an input element. While first might be possible to detect by listening to a gesture event (probably), what about second?

And how to tell if the page is scaled at all?

like image 644
jayarjo Avatar asked Nov 03 '22 15:11

jayarjo


1 Answers

When you zoom in, window.innerWidth is adjusted, but document.documentElement.clientWidth is not, therefore:

zoom = document.documentElement.clientWidth / window.innerWidth;
like image 111
kosiakMD Avatar answered Nov 08 '22 09:11

kosiakMD