// Window properties v1.1 // documentation: http://www.dithered.com/javascript/window_properties/index.html // license: http://creativecommons.org/licenses/by/1.0/ // code by Chris Nott (chris[at]dithered[dot]com) function getInnerWidth(win) { var winWidth; if (win.innerWidth) { winWidth = win.innerWidth; } else if (win.document.documentElement && win.document.documentElement.clientWidth) { winWidth = win.document.documentElement.clientWidth; } else if (document.body) { winWidth = win.document.body.clientWidth; } return winWidth; } function getInnerHeight(win) { var winHeight; if (win.innerHeight) { winHeight = win.innerHeight; } else if (win.document.documentElement && win.document.documentElement.clientHeight) { winHeight = win.document.documentElement.clientHeight; } else if (win.document.body) { winHeight = win.document.body.clientHeight; } return winHeight; } function getScrollTop(win) { var scrollTop = 0; if (win.pageYOffset) { scrollTop = win.pageYOffset; } else if (win.document.documentElement && win.document.documentElement.scrollTop) { scrollTop = win.document.body.scrollTop; } else if (win.document.body) { scrollTop = win.document.body.scrollTop; } return scrollTop; } function getScrollLeft(win) { var scrollLeft = 0; if (win.pageXOffset) { scrollLeft = win.pageXOffset; } else if (win.document.documentElement && win.document.documentElement.scrollLeft) { scrollLeft = win.document.body.scrollLeft; } else if (win.document.body) { scrollLeft = win.document.body.scrollLeft; } return scrollLeft; }