Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
added $.mobile.iosorientationfixEnabled option, which can be disabled…
Browse files Browse the repository at this point in the history
… at mobileinit
  • Loading branch information
Scott Jehl committed Dec 10, 2012
1 parent 522c3d7 commit 492fabd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions js/jquery.mobile.zoom.iosorientationfix.js
Expand Up @@ -7,9 +7,12 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.zoom" ], function(
//>>excludeEnd("jqmBuildExclude");
(function( $, window ) {

$.mobile.iosorientationfixEnabled = true;

// This fix addresses an iOS bug, so return early if the UA claims it's something else.
var ua = navigator.userAgent;
if( !( /iPhone|iPad|iPod/.test( navigator.platform ) && /OS [1-5]_[0-9_]* like Mac OS X/i.test( ua ) && ua.indexOf( "AppleWebKit" ) > -1 ) ){
$.mobile.iosorientationfixEnabled = false;
return;
}

Expand All @@ -34,9 +37,13 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.zoom" ], function(
}
}

$( window )
.bind( "orientationchange.iosorientationfix", zoom.enable )
.bind( "devicemotion.iosorientationfix", checkTilt );
$( document ).on( "mobileinit", function(){
if( $.mobile.iosorientationfixEnabled ){
$( window )
.bind( "orientationchange.iosorientationfix", zoom.enable )
.bind( "devicemotion.iosorientationfix", checkTilt );
}
});

}( jQuery, this ));
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
Expand Down

0 comments on commit 492fabd

Please sign in to comment.