I'm using JQuery UI for drag and drop tree nodes and its working fine.
I need to improvise it in terms of much more user interactive, When i drag any element it shows the same element name, you can see in the image (Test 3 I've dragged to down).
But my requirement is when I drag any tree node it should show the image specified, instead of same text. Is it possible?
My draggable function as follows, what changes i need to do to achieve the requirement.
$("li a").draggable({
revert: "invalid",
containment: "document",
helper: "clone",
cursor: "move",
start: function(event, ui) {
var draggedId = event.target.id;
}
});
Use helper: function() for that. It allows for a helper element to be used for dragging display.
Working Demo
Reference
As was suggested, you can make a special helper. Here is a working example: https://jsfiddle.net/Twisty/ja1635y9/
HTML
JQuery
The function creates a
div
and sets the background, nice and tidy. I then added the text to aspan
inside, so I could position it easier. Since it is seen as a link, I suppressed theclick
event.