From: andy matthews Date: Mon, 20 Feb 2012 15:00:07 +0000 (-0600) Subject: Adding Scott Jehl's fix for the iOS orientation bug X-Git-Url: https://git.mdrn.pl/ReadingsJQM.git/commitdiff_plain/3622a0597edc94dbfdb1bc893d3ade87e501306f?ds=sidebyside;hp=-c Adding Scott Jehl's fix for the iOS orientation bug --- 3622a0597edc94dbfdb1bc893d3ade87e501306f diff --git a/index.html b/index.html index 51c1953..e4ba955 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,7 @@ + diff --git a/js/ios-orientationchange-fix.min.js b/js/ios-orientationchange-fix.min.js new file mode 100644 index 0000000..83ff5b1 --- /dev/null +++ b/js/ios-orientationchange-fix.min.js @@ -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 diff --git a/readme.md b/readme.md index 317b43f..c6f78e7 100644 --- 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