Is there a way to disable zoom on a div, or any particular elements on a website? For example, if I wanted the page to be zoomable, but not the #Header div, is there a way to make one zoomable, and the other not zoomable?
Basically, when you zoom on a mobile device, it zooms the Header too, but I want the header to be a fixed size at all times (not zoomable).
I know that you can use this code to disable zooming overall:
<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' name='viewport' />
You can't do that without clever hacks.
However, you can (and should) use the following CSS to fix zoom issues on mobile devices:
header { position: fixed; ... } @media only screen and (max-width: 720px) { header { position: absolute; } }
This code enables position: absolute
when display width is less or equal 720px, and header becomes the part of the page, rather than being fixed on top.
I don't think you can do that directly. One possible option would be to detect the zooming through js events and scale elements accordingly.
Another option would be to "break" the CTRL key to disable zooming on your website, but that's just a big no-no.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With