Skip to content

Instantly share code, notes, and snippets.

@amadeuszblanik
Created November 7, 2019 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amadeuszblanik/f1995bacdb0a18ab657fbdbeb098a379 to your computer and use it in GitHub Desktop.
Save amadeuszblanik/f1995bacdb0a18ab657fbdbeb098a379 to your computer and use it in GitHub Desktop.
const preventDefault = evt => {
evt.preventDefault()
}
const disableScroll = () => {
window.addEventListener("touchmove", preventDefault, { passive: false })
window.addEventListener("touchend", preventDefault, { passive: false })
}
const enableScroll = () => {
window.removeEventListener("touchmove", preventDefault)
window.removeEventListener("touchend", preventDefault)
}
export { disableScroll, enableScroll }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment