HTML5 drag & drop: The dragged element content is missing in Webkit browsers.

Posted by Cibernox on Stack Overflow See other posts from Stack Overflow or by Cibernox
Published on 2010-12-25T17:03:19Z Indexed on 2010/12/26 0:54 UTC
Read the original article Hit count: 125

Filed under:
|
|
|

I'm trying to implement something similar to a cart where you can drop items from a list. This items (<li> elements) has some elements inside (divs, span, and that stuff). The drag and drop itself works great. But the dragged element's image doesn't show its content in Webkit browsers.

My list element has a border an a background color. In Firefox, the image is the whole item. In Webkit browsers, only the dragged element without content. I see the background and border, but without text inside.

I tried to make a copy of the element and force it to be the image, but doesn't work.

var dt = ev.originalEvent.dataTransfer;
dt.setDragImage( $(ev.target).clone()[0], 0, 0);

I have a simplified example that exhibit the same behavior: http://jsfiddle.net/ksnJf/1/

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html5