benjamincharity
1/12/2012 - 8:09 PM

This locks the viewport zoom until the user touches to zoom.

This locks the viewport zoom until the user touches to zoom.

  // 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);
  }