Skip to content

Instantly share code, notes, and snippets.

@dgreenway
Created September 27, 2013 17:28
Show Gist options
  • Save dgreenway/6732023 to your computer and use it in GitHub Desktop.
Save dgreenway/6732023 to your computer and use it in GitHub Desktop.
Listen for orientation change in mobile browser
// 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