Created
August 3, 2013 17:11
-
-
Save fharper/6147153 to your computer and use it in GitHub Desktop.
How to listen to orientation change on Firefox OS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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