例如,如果您有下面的代码,那么mousedown
没有发生时mousemove
和mouseup
事件会被破坏吗?当父事件结束时,子监听器是否被破坏?
var el = document.getElementById('mydiv');
el.addEvenListener('mousedown', function(event){
initializeStuff();
document.onmousemove = function(event) {
event = event || window.event;
showDragAnimation();
};
doucment.onmouseup = function() {
showFinalPosition();
};
}, false);
不,他们不是,你已经删除它们的代码。 – Teemu 2015-02-23 19:18:31
否。除非文件被销毁,否则这些事件将起作用。 – 2015-02-23 19:19:09
@Teemu或@jsve,这意味着'mouseup'会随时触发?或者只有在“mousedown”发生时才会启动? – ayjay 2015-02-23 19:23:04