Created
September 27, 2013 17:28
-
-
Save dgreenway/6732023 to your computer and use it in GitHub Desktop.
Listen for orientation change in mobile browser
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
// Listen for orientation changes | |
window.addEventListener("orientationchange", function() { | |
// Announce the new orientation number | |
console.log(window.orientation); | |
// 0 means portrait, 90 means landscape rotated to the left, -90 means landscape rotated to the right | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment