Currently, I am working on a task where I need to increase the value of a counter (var counter = 0;
) every time a draggable image is dropped into a dropzone, which is also an image rather than a div
.
$( "#goldbag" ).draggable({ revert: "invalid", containment: "parent" });
$( "#jack2" ).droppable({
drop: function(event, ui) {
draggedObj = ui.draggable.attr('id');
$("#"+draggedObj).fadeOut(function() { $(this).remove(); });
$( "img" ).draggable({ disabled: true });
}
});
The current functionality of this code is that it makes the droppable image fade out when dropped on the target. However, I aim to increment the counter by 1 before or after the image fades out.
Please note that both #goldbag
and #jack2
are images represented as <img>
elements within a shared parent container div
.