dppgma
Last Updated: February 25, 2016
·
1.01K
· benjamincharity
6ac0f08d12a11127a99aa8afc9fa015a

Lock iOS zoom until a user manually zooms.

// lock the zoom unless the user is manually zooming
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);
}
Say Thanks
Respond