Disable zoom on a div, but allow zoom on the page (an alternate div)

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.


In shorter, you certainly can do that.

You can trap window resize events and resize your floating div according to the dpi change calculated from the various new window and inner width and height attributes.

So, when you zoom in, you want to shrink the floating div so it retains the original dpi, and vice versa.

This would be an epic fiddle - revisit this answer soon, since I may have to do such a thing. Already noticing some cross-browser inconsistencies with dpi, so yeah, fun.