/ Published in: JavaScript
Returns window size as object.
winsize.x = window width;
winsize.y = window height;
winsize.x = window width;
winsize.y = window height;
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getWindowSize(){ var x = 0; var y = 0; if (self.innerHeight) { x = self.innerWidth; y = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { x = document.documentElement.clientWidth; y = document.documentElement.clientHeight; } else if (document.body) { x = document.body.clientWidth; y = document.body.clientHeight; } return {"x":x,"y":y}; }
URL: http://perpetualtechnologies.net