Edward
Edward

Reputation: 43

I can't get the right window height for IE7

I think I've tried everything to get the right window height in IE7 but all in vain.

Is there 1 surefire way to get the right window(viewport) height in IE7 and the other (better) browsers?

I've tried:

window.innerHeight(), 
document.innerHeight()

Jquery:

$(window).height(), 
$('body').height(), 
$('body').css('height')

The website link

Upvotes: 4

Views: 1934

Answers (1)

Erik
Erik

Reputation: 20722

$(window).height();

Will return the proper viewport height on IE7 - it could be how you're using it. If you try the following:

alert($(window).height());

You'll see its working (just tested IE7). If that simple bit of code doesn't work for you, make sure the jQuery library is loading properly, and make sure that you're checking the height inside a document.ready block.

Upvotes: 5

Related Questions