意外停止touchend触发链接 [英] Stop touchend firing links unintentionally

查看:97
本文介绍了意外停止touchend触发链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用touchend事件来防止ios要求两次触摸才能触发href链接. 效果很好,但是在滚动时会无意中触发链接.

I'm using the touchendevent to prevent ios from requiring two touches to fire href links. This works fine however it is firing the links unintentionally when scrolling.

我知道解决方案是实现touchstart来查看是否有运动,但是我是一名jQuery新手,并且不确定如何应用它.

I know that the the solution is to implement the touchstart to see if there is movement, but I'm a jquery novice and I'm not sure how apply this.

这是touchend代码

$('a').on('touchend', function(e) {
var el = $(this);
var link = el.attr('href');
window.location = link;
});

希望有人可以提供帮助.

Hope someone can help.

谢谢

推荐答案

好,这就是我使用

这对我有用.

这篇关于意外停止touchend触发链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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