Created
May 17, 2013 19:25
-
-
Save ridgehkr/5601352 to your computer and use it in GitHub Desktop.
correct a screen-zoom issue on rotation in iOS - rewritten in CoffeeScript
// by @mathias, @cheeaun and @jdalton // modified by @jpamental and @ridgehkr
This file contains hidden or 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
((doc)-> | |
addEvent = 'addEventListener' | |
type = 'gesturestart' | |
qsa = 'querySelectorAll' | |
scales = [1, 1] | |
meta = if qsa of doc then doc[qsa]('meta[name=viewport]') else [] | |
fix = -> | |
meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1] | |
doc.removeEventListener(type, fix, true) | |
if (meta = meta[meta.length - 1]) and addEvent of doc | |
do fix | |
scales = [0.25, 1.6] | |
doc[addEvent](type, fix, true) | |
)(document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment