【问题标题】:Tap events not triggering for TouchSwipe点击事件未触发 TouchSwipe
【发布时间】:2015-06-06 13:10:46
【问题描述】:

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

加载的唯一 javascript 文件是 jquery 1.10.2 和 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 触发。水龙头没有。有没有我需要做的设置?谢谢。

【问题讨论】:

标签: javascript jquery touchswipe


【解决方案1】:

这将是一个简短的答案,但却是一个有效的答案。您不能将threshold: 0 设置为内部,这将禁用所有点击/单击事件。将 threshold 设置为大于 0 的任何值,或完全省略它(默认为 75)以使点击功能正常工作 (source code)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多