Last active
October 6, 2015 13:47
-
-
Save stefano-bortolotti/3002454 to your computer and use it in GitHub Desktop.
JS: detect screen orientation
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
switch (window.orientation) { | |
case 90: | |
case -90: document.body.setAttribute('landscape', 'landscape'); | |
break; | |
case 0: | |
case 180: document.body.removeAttribute('landscape'); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment