我遇到了Chrome和Opera的错误,我想知道它是否已知,如果是,是否有解决方案?
如果我在dragstart事件上更改DOM,它会立即触发drag事件?这是一个bug还是背后有一些原因?只能在Chrome和Opera中发生。 Firefox工程。
我感谢每一个答案。
$('body').on({
dragstart: function(e) {
dragProfilefieldSrcElformid = $(this).attr("data-profilefieldid-formid");
e.dataTransfer = e.originalEvent.dataTransfer;
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/html', $(this).attr("data-profilefieldid"));
// Changing the DOM, fires the dragend Event in Chrome?
$("#plugin_loginlogout_pfcontainer_" + dragProfilefieldSrcElformid).find(".plugin_loginlogout_pf_entryfield").addClass("highlight"); // This doesn't work in Chrome and Opera, but in Firefox
},
dragend: function() {
console.log("dragend");
}
".plugin_loginlogout_pf");
编辑:
将DOM Change放在setTimeout函数中似乎可以解决问题!