Scroll and click events conflicting
I have a scrollableView with click and scroll events on it. When I click, I want one thing to happen. When I scroll, I only want it to trigger the scroll event. Right now both are firing.
Any thoughts? Thanks.
2 Answers
-
Accepted Answer
I think you should change the click event with touchend, and on scroll event to set a flag "scrolled"
This way when touchend triggers you act only if "scrolled" is not set.var scrolled = false; event scroll -> { scrolled = true; do the scroll action.. } event touchend -> { if ( !scrolled) { do the click action.. } scrolled = false // reset the scrolled flag }
-
When available, i use singletap instead of click, click is too sensitive, good for ad may be…. :)