Skip to content

Instantly share code, notes, and snippets.

@k5e
Forked from fharper/orientation.js
Created October 9, 2013 11:26
Show Gist options
  • Select an option

  • Save k5e/6899768 to your computer and use it in GitHub Desktop.

Select an option

Save k5e/6899768 to your computer and use it in GitHub Desktop.
function functionToCallOnorientationChange() {
var orientation = screen.mozOrientation;
if (orientation === "portrait-primary" || orientation === "portrait-secondary" ) {
//do something
}
else if if (orientation === "landscape-primary" || orientation === "landscape-secondary" ) {
//do something else
}
}
window.screen.onmozorientationchange = functionToCallOnorientationChange;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment