Apparently you can use and image element or a canvas element with HTML5's native drag and drop setDragImage(). This overrides the native 'ghosted' image of what you're dragging.
However I can't seem to get it to work, does anyone know what I'm missing?
var canvas = document.createElement('canvas');
context = canvas.getContext('2d');
context.height = '100px';
context.width = '200px';
context.fillStyle = 'blue';
context.font = 'bold 16px Arial';
context.fillText('hello world', 0, 16);
context.fillRect(20, 10, 200, 100);
console.log(canvas);
e.dataTransfer.setDragImage( canvas, 50,50 );
Also, I'm very surprised that I cannot use a div with createElement()
I guess the div must already exist to use that as the drag image?
var dragIcon = document.createElement('div');
dragIcon.style.cssText = 'width:200px;height:100px;background-color:red;';