<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=JavaScript_-_iOS_Orientation_Change_Fix</id>
	<title>JavaScript - iOS Orientation Change Fix - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stephanschlegel.de/index.php?action=history&amp;feed=atom&amp;title=JavaScript_-_iOS_Orientation_Change_Fix"/>
	<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=JavaScript_-_iOS_Orientation_Change_Fix&amp;action=history"/>
	<updated>2026-05-07T06:11:26Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Wikizone</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.stephanschlegel.de/index.php?title=JavaScript_-_iOS_Orientation_Change_Fix&amp;diff=22555&amp;oldid=prev</id>
		<title>37.49.32.84: Die Seite wurde neu angelegt: „&lt;syntaxhighlight lang=&quot;javascript&quot;&gt; /*! A fix for the iOS orientationchange zoom bug.  Script by @scottjehl, rebound by @wilto.  MIT / GPLv2 License. */ (funct…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.stephanschlegel.de/index.php?title=JavaScript_-_iOS_Orientation_Change_Fix&amp;diff=22555&amp;oldid=prev"/>
		<updated>2017-10-30T09:41:25Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt; &lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;! A fix for the iOS orientationchange zoom bug.  Script by @scottjehl, rebound by @wilto.  MIT / GPLv2 License.: &lt;/span&gt; (funct…“&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
/*! A fix for the iOS orientationchange zoom bug.&lt;br /&gt;
 Script by @scottjehl, rebound by @wilto.&lt;br /&gt;
 MIT / GPLv2 License.&lt;br /&gt;
*/&lt;br /&gt;
(function(w){&lt;br /&gt;
	&lt;br /&gt;
	// This fix addresses an iOS bug, so return early if the UA claims it&amp;#039;s something else.&lt;br /&gt;
	var ua = navigator.userAgent;&lt;br /&gt;
	if( !( /iPhone|iPad|iPod/.test( navigator.platform ) &amp;amp;&amp;amp; /OS [1-5]_[0-9_]* like Mac OS X/i.test(ua) &amp;amp;&amp;amp; ua.indexOf( &amp;quot;AppleWebKit&amp;quot; ) &amp;gt; -1 ) ){&lt;br /&gt;
		return;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
    var doc = w.document;&lt;br /&gt;
&lt;br /&gt;
    if( !doc.querySelector ){ return; }&lt;br /&gt;
&lt;br /&gt;
    var meta = doc.querySelector( &amp;quot;meta[name=viewport]&amp;quot; ),&lt;br /&gt;
        initialContent = meta &amp;amp;&amp;amp; meta.getAttribute( &amp;quot;content&amp;quot; ),&lt;br /&gt;
        disabledZoom = initialContent + &amp;quot;,maximum-scale=1&amp;quot;,&lt;br /&gt;
        enabledZoom = initialContent + &amp;quot;,maximum-scale=10&amp;quot;,&lt;br /&gt;
        enabled = true,&lt;br /&gt;
		x, y, z, aig;&lt;br /&gt;
&lt;br /&gt;
    if( !meta ){ return; }&lt;br /&gt;
&lt;br /&gt;
    function restoreZoom(){&lt;br /&gt;
        meta.setAttribute( &amp;quot;content&amp;quot;, enabledZoom );&lt;br /&gt;
        enabled = true;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    function disableZoom(){&lt;br /&gt;
        meta.setAttribute( &amp;quot;content&amp;quot;, disabledZoom );&lt;br /&gt;
        enabled = false;&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
    function checkTilt( e ){&lt;br /&gt;
		aig = e.accelerationIncludingGravity;&lt;br /&gt;
		x = Math.abs( aig.x );&lt;br /&gt;
		y = Math.abs( aig.y );&lt;br /&gt;
		z = Math.abs( aig.z );&lt;br /&gt;
				&lt;br /&gt;
		// If portrait orientation and in one of the danger zones&lt;br /&gt;
        if( (!w.orientation || w.orientation === 180) &amp;amp;&amp;amp; ( x &amp;gt; 7 || ( ( z &amp;gt; 6 &amp;amp;&amp;amp; y &amp;lt; 8 || z &amp;lt; 8 &amp;amp;&amp;amp; y &amp;gt; 6 ) &amp;amp;&amp;amp; x &amp;gt; 5 ) ) ){&lt;br /&gt;
			if( enabled ){&lt;br /&gt;
				disableZoom();&lt;br /&gt;
			}        	&lt;br /&gt;
        }&lt;br /&gt;
		else if( !enabled ){&lt;br /&gt;
			restoreZoom();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
	&lt;br /&gt;
	w.addEventListener( &amp;quot;orientationchange&amp;quot;, restoreZoom, false );&lt;br /&gt;
	w.addEventListener( &amp;quot;devicemotion&amp;quot;, checkTilt, false );&lt;br /&gt;
&lt;br /&gt;
})( this );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>37.49.32.84</name></author>
	</entry>
</feed>