jQuery: Drag custom Clone helper with the correct width
November 11th, 2009 by jeremychoneOften, when you drag an element with the helper = ‘clone’, you want the clone element width to be equal to the draggable element width. Unfortunately, this works only if the “width” has been set to the draggable element.
The solution, is to create a custom method for the helper like:
$(”.draggableElement”).draggable({
helper: function(){
return $(this).clone().width($(this).width());
},
revert: “invalid”
});