Skip to content

Instantly share code, notes, and snippets.

@fharper
Created August 3, 2013 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fharper/6147153 to your computer and use it in GitHub Desktop.
Save fharper/6147153 to your computer and use it in GitHub Desktop.
How to listen to orientation change on Firefox OS
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