'触摸屏'如果在touchstart上移除被触摸的子元素,则不激发父元素的事件

'Touchend' event of the parent do not fire if remove touched child element on touchstart

本文关键字:元素 事件 如果 触摸屏 touchstart 触摸      更新时间:2023-09-26

有一个描述touchstart和touchend事件的父div。它有一个完全覆盖父母的孩子。在触摸启动时,我删除了孩子并添加了另一个。在这种情况下,将不会触发touchend事件。在这种情况下,相同的鼠标事件(mousedonw/mouseup)运行良好。

这是小提琴。

我不能使用鼠标事件,因为在设备(iPad、Android)上,mousedown事件实际上不是在用户开始触摸元素时调用的,而是在mouseup之前调用的。

好的,看起来我找到了解决方案。我需要组合订阅:touchstart和mouseup事件。

http://jsfiddle.net/e3bUq/27/