When i drop the draggable div in the drop zone, it is going to the top left corner. Then then one after goes below it.
I need it so if i drop it in the middle of the drop zone, then it will append when i left it. So i am trying to use the positions and setting the css but its not working
here is my js
$('.tab-list img').draggable({
helper: "clone"
});
$('#main').droppable({
drop:function(event, ui) {
var item = $(ui.draggable);
var add;
if(item.data('itemstate') == 'rectangle'){
add = '<div class="pi-rectangle"></div>';
}
$(add).css('left', ui.position.left);
$(add).css('top', ui.position.top);
console.log(ui.position.top);
console.log(ui.position.left);
$(add).appendTo(this);
}
});