Here I have some big div, but it ghost is too big for me, and I want to change it. Here is my solution:
<div draggable = "true" id = "ololo">
</div>
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);
}
Jsffidle demo It works fine, but is it good use it in production? Why there is a scroll bar even I hidded it when it is overflow?