Skip to content

Instantly share code, notes, and snippets.

@hmmhmmhm
Created March 18, 2020 08:15
Show Gist options
  • Save hmmhmmhm/97897971ef7a8ca00eb6836824575a9c to your computer and use it in GitHub Desktop.
Save hmmhmmhm/97897971ef7a8ca00eb6836824575a9c to your computer and use it in GitHub Desktop.
iOSZoomPrevent.ts
// 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