Skip to content

Instantly share code, notes, and snippets.

@MoritzBuetzer
Last active August 29, 2015 14:03
Show Gist options
  • Save MoritzBuetzer/887296282e3fe4a6d646 to your computer and use it in GitHub Desktop.
Save MoritzBuetzer/887296282e3fe4a6d646 to your computer and use it in GitHub Desktop.
orientationchange
window.addEventListener('orientationchange', handleOrientation, false);
function handleOrientation() {
if (orientation == 0) {
//portraitMode
} else if (orientation == 90) {
//landscapeMode
} else if (orientation == -90) {
//landscapeMode
} else if (orientation == 180) {
//portraitMode
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment