Last active
August 29, 2015 14:17
-
-
Save Alex1990/4d1e23fe2440858acaee to your computer and use it in GitHub Desktop.
Get window(aka viewport) width and height.
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
| /** | |
| * Get window/viewport width and height. The window.innerWidth value includes the scrollbar, | |
| * and document.documentElement.clientWidth/document.body.clientWidth doesn't include. | |
| * Compatibility: IE6+ and other modern browsers | |
| */ | |
| function winW() { | |
| return window.innerWidth || document.documentElement.clientWidth; | |
| } | |
| function winH() { | |
| return window.innerHeight || document.documentElement.clientHeight; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment