Created
May 9, 2013 10:43
-
-
Save reyesyang/5546815 to your computer and use it in GitHub Desktop.
Get window width and height, get from http://www.geekpedia.com/code100_Get-window-width-and-height.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetWidth() | |
{ | |
var x = 0; | |
if (self.innerHeight) | |
{ | |
x = self.innerWidth; | |
} | |
else if (document.documentElement && document.documentElement.clientHeight) | |
{ | |
x = document.documentElement.clientWidth; | |
} | |
else if (document.body) | |
{ | |
x = document.body.clientWidth; | |
} | |
return x; | |
} | |
function GetHeight() | |
{ | |
var y = 0; | |
if (self.innerHeight) | |
{ | |
y = self.innerHeight; | |
} | |
else if (document.documentElement && document.documentElement.clientHeight) | |
{ | |
y = document.documentElement.clientHeight; | |
} | |
else if (document.body) | |
{ | |
y = document.body.clientHeight; | |
} | |
return y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment