I am dragging an element (draggable) inside another one (droppable), when it drops, it clones the object to the droppable div. But with no position info, so the cloned object is 0 left and 0 top. My code is as follows:
$('#objects div').draggable({revert: 'invalid', helper: 'clone'});
$('#objects').droppable({});
$('.ace').droppable({
drop:function(e, ui){
var clone = $(ui.draggable).clone();
var parent = $('.ace');
ui.draggable.detach();
clone.appendTo(parent);
}
});
I know i should calculate the dragged object position against the container position and set the data into the clone position, but I can`t get the dragged object position from the droppable method, neither I could clone the object from the draggable method properly.
What am I missing? Thanks in advance!