更新时间:2023-12-03 13:19:22
touchend 事件为止。
触发 touchstart
事件的视图的伪代码如下所示:
I fixed this issue by caching the element until touchend
event is emitted.
The pseudo code for the view that triggered the touchstart
event would look something like this:
view.remove = function () {
if (didViewStartTouchEvents) {
var _this = this;
this.hideElement(); // display: none, opacity: 0, etc
elementCache.appendChild(this); //append this element to some other place like body. Not needed but might be handy depending on situation
document.body.addEventListener('touchend', function () {
_this.didViewStartTouchEvents = false;
_this.remove();
});
} else {
// regular remove & cleanup
}
}