Created
April 28, 2014 15:53
-
-
Save unruthless/11376185 to your computer and use it in GitHub Desktop.
Prevent pinch-to-zoom on Win8/Chrome tablet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
function preventPinchToZoom(event) { | |
if (event.touches.length >= 2) { | |
event.stopPropagation(); | |
event.preventDefault(); | |
} | |
} | |
document.addEventListener('touchmove', preventPinchToZoom, false); | |
}()); |
Does it need to be JS? I think adding user-scalable=no
to the viewport meta tag would solve this, too, right? (dunno about Win8)
e.g.
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" />
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful when prototyping a non-web interface using web technologies.
I'm sure there's a better way to do this - feedback and pull requests welcome!