why is $(window).height() so wrong?

jquery

Solution

One possible reason may be that you are checking the console with firebug/ something else. So that you don't get window height correct due to firebug height.

You can try something like this:

take a span/div in you document:

<span id="res"></span>

and then

$(window).on('resize',function() { 
  $('#res').html("new height is: "+$(window).height()); 
});

Or if you want to check out put on firebug console then detach it from browser and then check the result.

Problem

I'm trying to get the current browser viewport height, using ``` $(window).on('resize',function() { console.log("new height is: "+$(window).height()); }); ``` But I'm getting values that are way too low. When the viewport is around 850px tall, I'm getting values around 350 or 400px from height(). What's up? Example: http://jsfiddle.net/forgetcolor/SVqx9/

Original source

Related problems