Skip to content

Instantly share code, notes, and snippets.

@ericwwsun
Created June 26, 2012 20:42
Show Gist options
  • Save ericwwsun/2998826 to your computer and use it in GitHub Desktop.
Save ericwwsun/2998826 to your computer and use it in GitHub Desktop.
Javascript: iPad Orientation and scale, ref: http://adactio.com/journal/4470/
// iPad Orientation and scale , ref: http://adactio.com/journal/4470/
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
var viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0';
document.body.addEventListener('gesturestart', function () {
viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
}, false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment