Posts Tagged ‘Phonegap’

Phonegap 0.9.5 orientationchange javascript event

Wednesday, June 1st, 2011

Since Phonegap version 0.9.5 the orientationchange event is triggered on the document object instead of the window object. This might be a problem as most libraries (amongst jQueryMobile) expect the event to occur on the window object.

However, there is an easy solution (this one requires jQuery but can be easily adapted):

$(document).bind("orientationchange", function(event){
  $(window).trigger(event);
});