I'm getting started on a new mobile project at work. The first step is playing with the orientation of the device and updating the layout so it takes advantage of the available space.
The javascript event you're looking for is orientationchange. You can watch for this with the
jQuery on method.
1 | $(window).on( 'orientationchange' ,updateDisplay); |
The handler method will look at the window.orientation to figure out if it's portrait or landscape.
1 | if (Math.abs(window.orientation) === 90){ |
You can see an
example here.
Thanks for the post..
ReplyDeletehtml5 detect device orientation