I am creating a sorted list that uses HTML5 drag and drop. It works well, but I have an unpleasant problem when it comes to a ghostly image. The ghostly image always wants to return to the place from where it was. As a result, if the position of the list item changes, the ghost image will revert to the wrong list item.
Ideally, the ghost image should not be displayed at all after the event onDragEnd. I tried setting the image to a blank image on dragEnd using
handleDragEnd(e) {
e.dataTransfer.setDragImage(new Image(0, 0), 0, 0);
...
but I think you can use setDragImagein onDragStart.
Is there a way to hide the ghostly image, onDragEndor at least bring it back to the right place?
source
share