Last active
October 6, 2019 00:20
-
-
Save JoostKiens/d26db0882a2b304ae2adc7b437e9f30a to your computer and use it in GitHub Desktop.
Prevent pull down refresh on Chrome browser on iOS
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
const target = window | |
let lastY = 0 | |
target.addEventListener('touchmove', handleTouchMove) | |
function handleTouchMove(e) { | |
const { pageY } = e.changedTouches[0] | |
const scrollY = target.pageYOffset || target.scrollTop || 0 | |
if (pageY > lastY && scrollY === 0) { | |
e.preventDefault() | |
} | |
lastY = pageY | |
}) |
It's disabled all touch event
isabled all touch event
Right, we need all other touch
Yeah, seems it's no longer working 😿
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I.LOVE.YOU.