Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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.

— asked May 25th 2010 by Jon Bell
  • click
  • events
  • iphone
  • scroll

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
    — answered May 25th 2010 by Dan Tamas
  • When available, i use singletap instead of click, click is too sensitive, good for ad may be…. :)

    — answered May 25th 2010 by Daniel Lim
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.