How do i detect scroll direction / touch direction without actually scrolling on mobile and desktop?
I am currently using the below, but as we know this doesn’t work on mobile.
window.onwheel = e => {
if(e.deltaY >= 0){ //down
} else { //up
}
}
2
Answers
Resolved - I had this inside of an intersection observer and it turns out it wasn't detecting the element because the threshold was too high.
Try using touchstart and touchmove events. Here is an example:
However, you might have to adjust the sensitivity of the touch movement threshold for it to work.