Forked from benald/Cross-browser viewport height and width JS variables
Created
March 4, 2022 06:28
-
-
Save AdeptSEO/12ebe9343c30c2f59c8f716b33172e20 to your computer and use it in GitHub Desktop.
An accurate cross browser / device viewport measurement
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
// Set cross-browser viewport height and width variable | |
viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); | |
viewWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment