From the course: jQuery Mobile Essential Training
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Orientation events - jQuery Mobile Tutorial
From the course: jQuery Mobile Essential Training
Orientation events
To listen in for the orientation event, it's pretty similar to listening in for touch events. So you can see here in the snippets I've scrolled down to the Orientation example in chapter seven. So let's open up orientevents_start and what we're going to do is just copy this in. And we'll copy, and we'll paste. And you can see that when the page is created, we're listening in for the orientation change event. And when this fires, the event object will have a property on it called orientation. And that will be the string portrait or landscape, depending on which orientation the device was switched to. So, we're going to say this. Now, unfortunately, I don't have an emulator installed to show this to you. So, what would you normally do is, you'd run this. And when the page went from being portrait to landscape like this, that event would fire. Now again, this is not a real mobile device so it's not showing, but you can try this out on your local handset if you want to see this work, or…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.