By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,969 Members | 1,705 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,969 IT Pros & Developers. It's quick & easy.

How to get the Height of window

P: 6
Hello All,

How to get the dynamically increasing height of the window using javascript?\

Thank you all,
Apr 17 '08 #1
Share this Question
Share on Google+
1 Reply

P: 428
Here is one way- it adds a global winSize array with two methods.

Calling winSize[0]() returns the window width,
winSize[1]() returns the height.

Expand|Select|Wrap|Line Numbers
  1. (function(){
  2.     if(window.innerWidth){
  3.         winSize=[function(){ return window.innerWidth},
  4.         function(){return window.innerHeight}]
  5.     }
  6.     else{
  7.         var B= document.body;
  8.         var D= document.documentElement;
  9.         D= (D.clientWidth)? D: B;
  10.         winSize=[ function(){return D.clientWidth},
  11.         winHeight= function(){return D.clientHeight}]
  12.     }
  13. })()
Apr 17 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.