1k views
Function to get window size
Javascript
- function getWindowSize()
- {
- var winH, winW;
- if (window.innerWidth)
- {
- winW = window.innerWidth;
- winH = window.innerHeight;
- }
- else if (document.body && document.body.offsetWidth)
- {
- winW = document.body.offsetWidth;
- winH = document.body.offsetHeight;
- }
- return { height: winH, width: winW };
- }
Submitted by miguelSantirso about 1 year ago — last modified less than a minute ago