Touchmove event fired only once when child is remo

2019-08-29 08:21发布

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

0条回答
登录 后发表回答