$(window).height()
gets the height of the window when the page is loaded. However, when zooming in/out, I want the new viewpoint height. Is this possible?
It works fine resizing normal browsers, but I guess zooming in/out on a mobile doesn't fire $(window).resize()
? or at least it doesn't update the window's size
Just to clarify, I'm talking about zooming on mobile browsers. I'm simulating the css attribute position:fixed using jQuery.
$(elements).css('top', $("body").scrollTop() - 42 + $(window).height() / 2)
is the code I'm using. It basically makes the elements centred vertically on the screen. This is being fired on $(window).resize
and $(window).scroll
. The code works correctly to begin with, but zooming doesn't update the $(window).height()
Edit
So I suppose another way of asking: Any ideas of how to get the centre of the viewpoint in javascript/jQuery?