Skip to content

Instantly share code, notes, and snippets.

@EvanLovely
Created August 13, 2012 23:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save EvanLovely/3344664 to your computer and use it in GitHub Desktop.
Save EvanLovely/3344664 to your computer and use it in GitHub Desktop.
reset scaling on iPads on orientation change
// 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