VuNguyen – 12-59 Mar 4
Hey, how do I check if user is swiping up or down using JS?
Here is my attempt:
Store the initial
The problem is, if user swiping down, but decide to swipe up, it stills count as swiping down, because the current
How do I fix this problem. Thank you.
Here is my attempt:
Store the initial
touchY in onTouchStart, then compare the initial touchY to touchY in onTouchMove. if current touchY is larger than initial touchY then it is considered that the user is swiping down, otherwise swiping up.The problem is, if user swiping down, but decide to swipe up, it stills count as swiping down, because the current
touchY still larger than initial touchYHow do I fix this problem. Thank you.
