Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using the <code>maximum-scale</code> and <code>minimum-scale</code>to stop zooming don't really work because then you take away the user's ability to zoom. That's really a bad idea because it makes your users with bad eyes angry that your website doesn't zoom, while other websites do...</p> <p>I tried timeouts and all kinds of fancy javascript, then I found this: <a href="https://github.com/scottjehl/iOS-Orientationchange-Fix" rel="nofollow noreferrer">https://github.com/scottjehl/iOS-Orientationchange-Fix</a></p> <p>via this related question: <a href="https://stackoverflow.com/questions/2557801/how-do-i-reset-the-scale-zoom-of-a-web-app-on-an-orientation-change-on-the-iphon">How do I reset the scale/zoom of a web app on an orientation change on the iPhone?</a></p> <p>On that post, Andrew Ashbacher posted a link to the code written by Scott Jehl:</p> <pre><code>/*! A fix for the iOS orientationchange zoom bug. Script by @scottjehl, rebound by @wilto.MIT License.*/(function(m){if(!(/iPhone|iPad|iPod/.test(navigator.platform)&amp;&amp;navigator.userAgent.indexOf("AppleWebKit")&gt;-1)){return}var l=m.document;if(!l.querySelector){return}var n=l.querySelector("meta[name=viewport]"),a=n&amp;&amp;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&amp;&amp;(j&gt;7||((h&gt;6&amp;&amp;i&lt;8||h&lt;8&amp;&amp;i&gt;6)&amp;&amp;j&gt;5))){if(g){b()}}else{if(!g){f()}}}m.addEventListener("orientationchange",f,false);m.addEventListener("devicemotion",e,false)})(this); </code></pre> <p>That is a solution wrapped nicely in an <a href="http://benalman.com/news/2010/11/immediately-invoked-function-expression/" rel="nofollow noreferrer">IIFE</a> so you don't have to worry about name-space issues.</p> <p>Just drop it in to your script (not into <code>document.ready()</code> if you're using jQuery) and viola!</p> <p>All it does is disable zoom on <code>devicemotion</code> events that indicate that <code>orientationchange</code> is imminent. It's the best solution I've seen because it actually works and doesn't disable zoom.</p> <p>EDIT: this approach is not always reliable, especially when you are holding the ipad at an angle. also, i don't think this event is available to gen 1 ipads</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload