javascript - Dragging element obscures drop target -
i'm using native html5 drag , drop api drag elements on page. problem i'm having dragged element rather large , it's current position obscures of drop targets. when set dragged element display none or visibility hidden or pointer events none, or position absolute , left -10000px dragend
event triggered on element.
is there way overcome it?
did try create temporary element behave shadow?
function drag(ev) { var shadow = createshadowelement(); var element = document.getelementbyid(ev.target.id); element.appendchild(shadow); ev.datatransfer.setdragimage(shadow, 0, 0); ev.datatransfer.setdata("text", ev.target.id); } function drop(ev) { ev.preventdefault(); var data = ev.datatransfer.getdata("text"); var element = document.getelementbyid(data); ev.target.appendchild(element); } function dragend(ev) { removeshadowelement(); }
Comments
Post a Comment