Last active
October 22, 2015 13:10
-
-
Save mildfuzz/5a5fc8f6a89824663d6a to your computer and use it in GitHub Desktop.
Shim for adding window.orientation to desktop environments. Only does 0 or 90, not -90
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
| (function(win) { | |
| if ('orientation' in win) return; | |
| if ('matchMedia' in win) { | |
| var mtch = win.matchMedia('(orientation: portrait)'); | |
| win.orientation = mtch.matches ? 0 : 90; | |
| mtch.addListener(function(m) { | |
| win.orientation = m.matches ? 0 : 90; | |
| }); | |
| } | |
| })(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment