Skip to content

Instantly share code, notes, and snippets.

@rissajeanne
Created November 8, 2011 17:50
Show Gist options
  • Save rissajeanne/1348516 to your computer and use it in GitHub Desktop.
Save rissajeanne/1348516 to your computer and use it in GitHub Desktop.
set viewport
// Option A: reset maximum-scale on blur
var viewportMeta = $('meta[name="viewport"]');
$('select[name="filter"]').bind('focus blur', function(event) {
viewportMeta.attr('content', 'width=device-width,initial-scale=1,maximum-scale=' + (event.type == 'blur' ? 10 : 1));
});
// Option B: limit maximum-scale to 1
var viewportMeta = $('meta[name="viewport"]');
$('select[name="filter"]').bind('focus blur', function(event) {
viewportMeta.attr('content', 'width=device-width,initial-scale=1,maximum-scale=1');
});
// Option C: prevent focus entirely
var viewportMeta = $('meta[name="viewport"]');
$('select[name="filter"]').focus(function() {
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment