Created
March 18, 2020 08:15
-
-
Save hmmhmmhm/97897971ef7a8ca00eb6836824575a9c to your computer and use it in GitHub Desktop.
iOSZoomPrevent.ts
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
// iOS Pinch Zoom 끄기 | |
document.documentElement.addEventListener( | |
'touchstart', | |
(event) => { | |
if (event.touches.length > 1) { | |
event.preventDefault() | |
} | |
}, | |
false | |
) | |
// iOS Double tab Zoom 끄기 | |
let lastTouchEnd = 0 | |
document.documentElement.addEventListener( | |
'touchend', | |
event => { | |
let now = new Date().getTime() | |
if (now - lastTouchEnd <= 300) { | |
event.preventDefault() | |
} | |
lastTouchEnd = now | |
}, | |
false | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment