Skip to content

Instantly share code, notes, and snippets.

@fharper
Created August 3, 2013 17:11
Embed
What would you like to do?
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