-
-
Save paulirish/2add4e06a1cebff2def0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/ | |
// http://adactio.com/journal/4470/ | |
var viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]'), | |
ua = navigator.userAgent, | |
gestureStart = function () { | |
viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6"; | |
}, | |
scaleFix = function () { | |
if (viewportmeta && /iPhone|iPad/.test(ua) && !/Opera Mini/.test(ua)) { | |
viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0"; | |
document.addEventListener("gesturestart", gestureStart, false); | |
} | |
}; | |
scaleFix(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check out @jdalton’s fork, it’s super hawt: https://gist.github.com/903131