Touchmove event fired only once when child is removed

拥有回忆 提交于 2019-12-12 01:30:46

问题


When registering a touchmove event on a parent, I only receive the first touchmove event, if the callback removes the child. I would like to keep receiving touchmove events on the parent, although the children inside, are removed or added.

I have prepared a JS-fiddle demoing the problem: http://jsfiddle.net/EVpML/3/

$("#parent").on('touchmove', function(e) {
    e.preventDefault();
    $("#child").remove();
    $('#messages').append('<p>fired</p>');
});

When touching and dragging the #parent (through the #child), the #child is removed and no more touchmove events are sent to the #parent.

I can confirm this in Chrome on Android 4.4.3 but to help you solve this, you can enable mobile touch emulation in Chrome, by following this guide: https://developer.chrome.com/devtools/docs/mobile-emulation

来源:https://stackoverflow.com/questions/24270204/touchmove-event-fired-only-once-when-child-is-removed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!