当我尝试移动 SVG 对象时,使用removeChild() 时它不起作用。移动时它还会阻止 touchmove 事件。
伪代码:
id.addEventListener("touchmove", function(e) {
if (selected == true) {
e.preventDefault();
moveY = y;
var n = document.getElementById("test"); // remove nodes
while (n.lastChild) {
n.removeChild(n.lastChild);
}
test.appendChild(createElementNS...); // add it again
}
}, false);
最佳答案
这不是SVG的问题,而是元素抑制的问题。消息不再到达。看Touch Move event don't fire after Touch Start target is removed 描述问题并提出解决方案
关于javascript - 使用removeChild时,使用JavaScript移动SVG对象会阻止Touchmove事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54162069/