Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added $.mobile.iosorientationfixEnabled option, which can be disabled…

… at mobileinit
  • Loading branch information...
commit 492fabda0aa93efd5e4f1be3654b465eaf7a609f 1 parent 522c3d7
Scott Jehl authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 js/jquery.mobile.zoom.iosorientationfix.js
View
13 js/jquery.mobile.zoom.iosorientationfix.js
@@ -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;
}
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.