Created
September 5, 2013 19:57
-
-
Save exonen/6455325 to your computer and use it in GitHub Desktop.
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
// Detect whether device supports orientationchange event, otherwise fall back to | |
// the resize event. | |
var supportsOrientationChange = 'onorientationchange' in window, | |
orientationEvent = supportsOrientationChange ? 'orientationchange' : 'resize'; | |
window.addEventListener(orientationEvent, function() { | |
window.alert('HOLY ROTATING SCREENS BATMAN:' + window.orientation + ' ' + screen.width); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment