-
-
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(); |
Oh your gist is Sweet!
yay.
sry i didnt see it linked up anywhere. toss a link on shichuan's post!
also checking that querySelector is both truthy AND a function is overkill yes. :)
Check out @jdalton’s fork, it’s super hawt: https://gist.github.com/903131
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I purposefully didn’t test for
document.querySelector
support in my gist, but if you’re gonna do so then why not use:Or would that be overkill?