Jquery draggable echo the dropped div class id
I'm trying to echo the div id where i drop the draggable cude. Any clue on
how to track where the div is drop. I read the .position from jquery but
did not figure it out.
Here is my Fiddle of this.
$('.drop').droppable({
tolerance: 'intersect',
drop: function(event, ui) {
var drop_p = $(this).offset();
var drag_p = ui.draggable.offset();
var left_end = drop_p.left - drag_p.left + 1;
var top_end = drop_p.top - drag_p.top + 1;
ui.draggable.animate({
top: '+=' + top_end,
left: '+=' + left_end
});
}
});
$('.boxArt').draggable({
revert: 'invalid',
scroll: false,
stack: ".boxArt"
});
Fiddle example
No comments:
Post a Comment