Closed ro-savage closed 9 years ago
I have the same issue :( Apparently, HammerJS handles it pretty good : http://stackoverflow.com/questions/22683122/how-to-bind-tap-and-doubletap-to-the-same-element-in-hammer-js
Did you find a fix/hack @ro-savage ?
Related to #22. Finger's goal is to keep KISS.
If you want to handle edge cases like this I would either advice to do it by yourself or eventually use another library (like Hammer) which resolves those issues, at the cost of a much larger size.
For your specific example, you could do something like this:
var tapTimeout;
$('button').on('tap', function() {
tapTimeout = setTimeout(function() {
$('body').append('<p>Click');
}, 300);
});
$('button').on('doubletap', function() {
clearTimeout(tapTimeout);
$('body').append('<p>Double tap');
});
I would like to be able to have multiple tap events on a single element.
However, when I double tap, the tap event is fired instantly.
Could there be an option added to delay the single tap event from occurring? Then if it detected another tap within the 'doubleTapInterval' it would fire the doubleTap event only and never fire the original tap event. If it didn't register another tap within the 'doubleTapInterval' it would fire just the single tap event?
Basically adding in the 300ms delay again, as an option.
Thank