JSFiddle - React, Tailwind, and code Playground

by mondayguy

HTML

<div draggable = "true" id = "ololo">
</div>

CSS

#ololo{
    background-color:red;
    width:300px;
    height:200px;
}

JavaScript

var k = document.getElementById("ololo");
k.addEventListener("dragstart", _drag, false);

function _drag(evt){
    var cl =  this.cloneNode(true);
    cl.style.backgroundColor = "blue";
    cl.style.width = "10px";
    cl.style.height = "10px";
    cl.style.position = "absolute";
    cl.style.left = "1000px";
    cl.style.overflow = "hidden";
    
    document.getElementsByTagName("body")[0].appendChild(cl);
    evt.dataTransfer.setDragImage(cl, 0, 0);
     
    window.setTimeout(function() {
       cl.parentNode.removeChild(cl);
    }, 1000);
    
}