Working your magic with Firefox OS – Listen to orientation change

| 1 min read
Article main image for Working your magic with Firefox OS – Listen to orientation change

FFxOS_Devs_twitterHeader_1252x626_1One of the things I tried to do in the Firefox OS application I'm building is to manage the screen orientation. I want my application to know when the user changed the orientation of the phone, so I can take action accordingly. To do this, you need to listen to onmozorientationchange, and once it's called, you are able to know which orientation the phone is now: portrait-primary, portrait-secondary, landscape-primary, and landscape-secondary.

https://gist.github.com/fharper/6147153

It's now time for you to add this feature to your application.