问题
I have a site that uses touchSwipe, which is working just fine with just swiping. The problem is that the tap events don't seem to work. At first, I thought that maybe it was because an existing script in the site was interfering with it somehow so I made a page that had nothing but the touchSwipe portion of my site but the tap event still would not fire.
The only javascript files loaded are jquery 1.10.2 and touchSwipe.
$(function() {
function msg(mm) {
$("#dontmindme").text(mm);
}
$("#dontmindme").swipe({
tap:function(event, target) {
msg("blah");
},
swipeLeft:function(event, direction, distance, duration, fingerCount) {
msg("yada");
},
threshold: 0
});
});
SwipeLeft fires. Tap does not. Is there a setting that I need to make? Thanks.
回答1:
This is going to be a short answer, but an effective one. You must not set threshold: 0
as internally that will disable all tap/click events. Set threshold
to anything higher than 0, or omit it completely (defaults to 75) to make the tap functions works (source code).
来源:https://stackoverflow.com/questions/29273929/tap-events-not-triggering-for-touchswipe