1.请看现象:https://codepen.io/xuyu/proje...2.我想实现的效果是复制被拖拽元素到指定区域,不想删除被拖拽元素.
1 回答
哈士奇WWW
TA贡献1799条经验 获得超6个赞
document.addEventListener("drop", function( event ) {
// prevent default action (open as link for some elements)
event.preventDefault();
// move dragged elem to the selected drop target
if ( event.target.className == "landingArea" ) {
event.target.style.background = "";
//dragged.parentNode.removeChild( dragged );
$(event.target).append($(dragged).clone().css('opacity', 1))
}
}, false);
添加回答
举报
0/150
提交
取消