Reputation: 40673
I have this bit of jQuery:
$('body').bind('orientationchange',function(event){
alert('orientationchange');
})
If you change the orientation of your device, it should trigger an alert. Works in iOS. Does not work in Android. Why?
JSBIN: http://jsbin.com/esacir
I thought perhaps Android doesn't fire that event on the body so also tried 'window': http://jsbin.com/esacir/3 still no-go.
Upvotes: 0
Views: 1545
Reputation: 40673
As usual with me, it was a syntax problem. The key is that the event has to be attached to the window (for android):
$(window).bind('orientationchange',function(event){
alert('orientationchange');
})
Upvotes: 0
Reputation: 14356
This works on Android:
window.onorientationchange = function() {
alert('onorientationchange');
}
Try declaring the method as done above.
Upvotes: 3