touchmove启动时取消touchend事件 [英] canceling touchend event when touchmove starts

查看:370
本文介绍了touchmove启动时取消touchend事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页应用中有一个可滚动的列表,使用可滚动性来处理溢出:滚动功能。虽然当我完成滚动并将手指伸出屏幕时,下面的事件也会触发。

I have a scrollable list in my web app, using scrollability to deal with the overflow:scroll feature. although when I finish scrolling and take my finger out of the screen the event bellow also triggers.

$('li').live('touchend', function (e) {
    //...
});

事情是我只想在上面没有touchmove事件的行动之前触发上面这个事件那个。

The thing is that I only would like this event above to fire when the action there's no touchmove event before that.

可以在 touchmove中抑制 touchend 事件活动?
所以它模拟iOS UITableView组件更好?当 touchmove 启动时,取消 touchend的目标

it is possible to suppress a touchend event from inside the touchmove event? so it simulates better the iOS UITableView component? where when touchmove starts it cancels the target for touchend

推荐答案

touchmove 中设置一个标志,可在 touchend 中进行测试,如果标志设置,只是跳过功能,可能 preventDefault()(无论哪种方式,最后重置标志)。

Set a flag in touchmove which can be tested in touchend and if the flag is set, just skip the functionality and possibly preventDefault() (either way, reset the flag at the end).

这篇关于touchmove启动时取消touchend事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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