Tap events not triggering for TouchSwipe

情到浓时终转凉″ 提交于 2020-02-08 09:10:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!