点击事件不会触发TouchSwipe [英] Tap events not triggering for TouchSwipe

查看:114
本文介绍了点击事件不会触发TouchSwipe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用touchSwipe的网站,只需滑动即可正常工作.问题在于点击事件似乎不起作用.起初,我认为可能是因为网站中的现有脚本以某种方式对其进行了干扰,所以我制作了一个页面,除了我网站的touchSwipe部分之外,什么都没有,但是tap事件仍然不会触发.

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.

唯一加载的javascript文件是jquery 1.10.2和touchSwipe.

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射击.点击不.我需要进行设定吗?谢谢.

SwipeLeft fires. Tap does not. Is there a setting that I need to make? Thanks.

推荐答案

这将是一个简短的答案,但是一个有效的答案.您不得在内部将threshold: 0设置为将禁用所有点击事件的事件.将threshold设置为大于0的任何值,或将其完全省略(默认为75)以使tap功能起作用(

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

这篇关于点击事件不会触发TouchSwipe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆