Skip to content

Instantly share code, notes, and snippets.

@pertrai1
Created September 12, 2013 11:48
Show Gist options
  • Save pertrai1/6536171 to your computer and use it in GitHub Desktop.
Save pertrai1/6536171 to your computer and use it in GitHub Desktop.
Detect Orientation
// 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