'Click' firing twice #452

Closed
KingScooty opened this Issue Aug 8, 2013 · 3 comments

Projects

None yet

5 participants

@KingScooty

I have a collection of divs with on click events attached to them. When setting iScroll({click : true});, the click events fire twice. Is there a way to prevent this?

Event passthrough was working, but i now have one iScroll event for horizontal scrolling, and a vertical iScroll event for each page inside the horizontal scrolling panel. I seem to be losing the click functionality when i don't have click set to true.

How can i prevent the click events from firing twice when ({click : true}) ?

@ullmark
ullmark commented Oct 3, 2013

I have this issue as well. For me it click options wasn't needed for desktop browsers, (btw, I am using links to catch clicks..) So I settled for this solution, albeit not perfect...

// my options
var options = {
  hScroll: false,
  vScrollbar: false,
  mouseWheel: true
};

// there is an issue with the "click" event fireing twice....
// - https://github.com/cubiq/iscroll/issues/270
// - https://github.com/cubiq/iscroll/issues/203
if (Modernizr.touch) {
  options.click = true;
}

// the options div should be the scrollable area.
this.iscroll = new IScroll(this.$('.options')[0], options);
@gimox
gimox commented Oct 20, 2013

genious!!! simple, perfect elegant.

@chrisleekr

First, thanks to @ullmark

For those who do not use Modernizr;

var isTouchScreen = 'createTouch' in document;

var options = {
  hScroll: false,
  vScrollbar: false,
  mouseWheel: true
};

if (isTouchScreen) {
   options.click = true;
}

this.iscroll = new IScroll(this.$('.options')[0], options);
@cubiq cubiq added a commit that referenced this issue Oct 29, 2013
@cubiq fix #439 #488 #517 #428 #270 #520 #447 #452 #509 052c5ba
@cubiq cubiq closed this Oct 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment