admin管理员组文章数量:1323715
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) {
//...
});
The thing is that I only would like this event above to fire when the action there's no touchmove event before that.
it is possible to suppress a touchend
event from inside the touchmove
event?
so it simulates better the iOS UITableView ponent? where when touchmove
starts it cancels the target for 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) {
//...
});
The thing is that I only would like this event above to fire when the action there's no touchmove event before that.
it is possible to suppress a touchend
event from inside the touchmove
event?
so it simulates better the iOS UITableView ponent? where when touchmove
starts it cancels the target for touchend
-
Perhaps set a flag in
touchmove
which can be tested intouchend
and if the flag is set, just skip the functionality and possiblypreventDefault()
(either way, reset the flag at the end). – Yaniro Commented Mar 10, 2012 at 18:59 - thanks a lot Yaniro, that was the smartest thing to do in this case. If you could set this as an anser I would be happy to mark this a correct :) – zanona Commented Mar 11, 2012 at 10:33
1 Answer
Reset to default 8Set 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).
本文标签: javascriptcanceling touchend event when touchmove startsStack Overflow
版权声明:本文标题:javascript - canceling touchend event when touchmove starts - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742125975a2421942.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论