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

Commit 492fabd

Browse files
author
Scott Jehl
committed
added $.mobile.iosorientationfixEnabled option, which can be disabled at mobileinit
1 parent 522c3d7 commit 492fabd

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

js/jquery.mobile.zoom.iosorientationfix.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.zoom" ], function(
77
//>>excludeEnd("jqmBuildExclude");
88
(function( $, window ) {
99

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

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

37-
$( window )
38-
.bind( "orientationchange.iosorientationfix", zoom.enable )
39-
.bind( "devicemotion.iosorientationfix", checkTilt );
40+
$( document ).on( "mobileinit", function(){
41+
if( $.mobile.iosorientationfixEnabled ){
42+
$( window )
43+
.bind( "orientationchange.iosorientationfix", zoom.enable )
44+
.bind( "devicemotion.iosorientationfix", checkTilt );
45+
}
46+
});
4047

4148
}( jQuery, this ));
4249
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);

0 commit comments

Comments
 (0)