意外停止touchend触发链接 [英] Stop touchend firing links unintentionally
本文介绍了意外停止touchend触发链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用touchend
事件来防止ios要求两次触摸才能触发href
链接.
效果很好,但是在滚动时会无意中触发链接.
I'm using the touchend
event 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屋!
查看全文