Adding Scott Jehl's fix for the iOS orientation bug
authorandy matthews <andy@commadelimited.com>
Mon, 20 Feb 2012 15:00:07 +0000 (09:00 -0600)
committerandy matthews <andy@commadelimited.com>
Mon, 20 Feb 2012 15:00:15 +0000 (09:00 -0600)
index.html
js/ios-orientationchange-fix.min.js [new file with mode: 0644]
readme.md

index 51c1953..e4ba955 100644 (file)
@@ -22,6 +22,7 @@
        <!-- Javascript includes -->
        <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
        <script src="/js/mobileinit.js"></script>
+       <script src="/js/ios-orientationchange-fix.min.js"></script>
        <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
        <script src="/js/application.js"></script>
 </head> 
diff --git a/js/ios-orientationchange-fix.min.js b/js/ios-orientationchange-fix.min.js
new file mode 100644 (file)
index 0000000..83ff5b1
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+       A fix for the iOS orientationchange zoom bug. Script by @scottjehl, rebound by @wilto.MIT License.
+       https://github.com/scottjehl/iOS-Orientationchange-Fix
+*/
+(function(m){if(!(/iPhone|iPad|iPod/.test(navigator.platform)&&navigator.userAgent.indexOf("AppleWebKit")>-1)){return}var l=m.document;if(!l.querySelector){return}var n=l.querySelector("meta[name=viewport]"),a=n&&n.getAttribute("content"),k=a+",maximum-scale=1",d=a+",maximum-scale=10",g=true,j,i,h,c;if(!n){return}function f(){n.setAttribute("content",d);g=true}function b(){n.setAttribute("content",k);g=false}function e(o){c=o.accelerationIncludingGravity;j=Math.abs(c.x);i=Math.abs(c.y);h=Math.abs(c.z);if(!m.orientation&&(j>7||((h>6&&i<8||h<8&&i>6)&&j>5))){if(g){b()}}else{if(!g){f()}}}m.addEventListener("orientationchange",f,false);m.addEventListener("devicemotion",e,false)})(this);
\ No newline at end of file
index 317b43f..c6f78e7 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -13,6 +13,7 @@ Clone the git repo - `git clone git@github.com:commadelimited/jQuery-Mobile-Boil
 * The latest jQuery bits from CDN, with a local option.
 * Override files for both JS and CSS
 * Extensive UI element snippet library. Easy to copy and paste.
+* Includes Scott Jehl's fix for the [iOS orientation bug](https://github.com/scottjehl/iOS-Orientationchange-Fix)
 
 ## Contributing
 
@@ -22,6 +23,7 @@ You are invited to contribute code and suggestions to this project. The more the
 
 * Source: http://github.com/commadelimited/jQuery-Mobile-Boilerplate
 * Twitter: [http://twitter.com/jqmbp](http://twitter.com/jqmbp)
+* Twitter: [http://twitter.com/commadelimited](http://twitter.com/commadelimited)
 
 ## License