Skip to content

Instantly share code, notes, and snippets.

@vincicat
Created May 9, 2011 15:07
Show Gist options
  • Save vincicat/962698 to your computer and use it in GitHub Desktop.
Save vincicat/962698 to your computer and use it in GitHub Desktop.
[iOS][Safari] Avoid :focus zooming #2
var $viewportMeta = $('meta[name="viewport"]');
$('input, select, textarea').bind('focus blur', function(event) {
$viewportMeta.attr('content', 'width=device-width,initial-scale=1,maximum-scale=' + (event.type == 'blur' ? 10 : 1));
});
//The browser starts zooming in but immediately zooms out again when the elements gets focus. I like that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment