Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript / jquery: how do I get the inner window height?

Like... the height that excludes the address bar, bookmarks, etc. just the viewing space.

$(window).innerHeight()

appears to not work.

like image 499
NullVoxPopuli Avatar asked Sep 24 '10 21:09

NullVoxPopuli


1 Answers

Use .height() for this, as mentioned in the API:

This method is also able to find the height of the window and document.

$(window).height();   // returns height of browser viewport
$(document).height(); // returns height of HTML document

As for why .innerHeight() isn't working:

This method is not applicable to window and document objects; for these, use .height() instead.

like image 111
Jonathan Lonowski Avatar answered Oct 12 '22 11:10

Jonathan Lonowski