问题描述
我的网页应用中有一个可滚动的列表,使用来处理溢出:滚动
功能。虽然当我完成滚动并将手指伸出屏幕时,下面的事件也会触发。
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事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!