Question

I'm trying to align a div to the center using $(window).width(). on Windows this trick works well, as $(window).width() changes when zooming the page.

However, When zooming the page on Chrome IOS, $(window).width() returns always the same value, causing the div to be aligned to center only when the page is not zoomed in (nor zoomed out)

any ideas?

Thanks.

No correct solution

OTHER TIPS

Window height doesn't change on zoom, otherwise all of your content would change too as it would trigger a resize event. You would need to find a way to detech what the scale of the zoom is. Say for example you zoom 2x, the correct integars for the calculations would be window height x 2, but I don't know a way currently to detect the viewport scale. Hopefully this answer might be a jumping off point for somebody wiser than I.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top