X-Git-Url: https://git.mdrn.pl/ReadingsJQM.git/blobdiff_plain/94fb0eedb97c76e80cf6137247e487f472fb8f07..3622a0597edc94dbfdb1bc893d3ade87e501306f:/js/ios-orientationchange-fix.min.js?ds=sidebyside 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