Created
March 12, 2014 16:22
-
-
Save stefano-bortolotti/9510470 to your computer and use it in GitHub Desktop.
Get Viewport dimensions
This file contains 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 _getViewportDimensions() { | |
var dEl = document.documentElement, | |
clientH = dEl['clientHeight'], | |
innerH = window['innerHeight'], | |
clientW = dEl['clientWidth'], | |
innerW = window['innerWidth']; | |
return { | |
height : ( clientH < innerH ) ? innerH : clientH, | |
width : ( clientW < innerW ) ? innerW : clientW | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment