Centering Draggable Element in Dropable After Drop in jQuery UI
Can you please take a look at T
his Demo and let me know how to force draggable element to be centered inside the droppable after drop?
- $(function () {
- $('#draggable').draggable({});
- $("#droppable").droppable({
- drop: function (event, ui) {
- $(this)
- .find("p")
- .html("Dropped!");
- $('#draggable').css("margin","2px");
- }
- });
- });
As you can see I already $('#draggable').css("margin","2px");
tried but this is not doing the job!
Thanks