0

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.

jsalita
  • 37
  • 11
  • For others arriving here, If #dontmindme is a link it will also not work by default. See the answer to this question for more ideas: http://stackoverflow.com/questions/27375748/jquery-touchswipe-plugin-doesnt-work-on-links – PhoebeB Nov 10 '15 at 19:14

1 Answers1

4

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).

Drakes
  • 23,254
  • 3
  • 51
  • 94