Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hqman/5425033 to your computer and use it in GitHub Desktop.
Save hqman/5425033 to your computer and use it in GitHub Desktop.
// reset scaling on iPads on orientation change. author: @axolx
if (navigator.userAgent.match(/iPad/i)) {
$(window).bind('orientationchange', function(event) {
if (window.orientation == 90 || window.orientation == -90 || window.orientation == 270) {
$('meta[name="viewport"]').attr('content', 'height=device-width,width=device-height,initial-scale=1.0,maximum-scale=1.0');
$(window).resize();
} else {
$('meta[name="viewport"]').attr('content', 'height=device-height,width=device-width,initial-scale=0.8,maximum-scale=0.8');
$(window).resize();
}
}).trigger('orientationchange');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment