0
$(function(){
      $(".item").draggable({
        revert:"invalid",
        revertDuration:"900",
        appendTo:'droppable-container'
      });

      $(".droppable-container").droppable({
        drop:function(event,ui){
          ui.draggable.appendTo(this);
        }
      })
    })

i just want to revert back the first dropped element after second element is dropped on droppable container,

i,e droppable container can have maximum of one item, if new item is dropped on droppable the the first dropped element must revert back to its parent.

please check the codepen link,darg and drop with revert on condition

newly added(dropped)item must remain and the previously added element must revert back to its parent. and also i want a animation effect when reverting the old/previously dropped item.

thank you...

Kaleem Nalband
  • 687
  • 7
  • 21
  • Welcome to Stack Overflow. So the first part of this is storing the original position in the `start` callback. So that later, the item can be returned to that position later if needed. The next part id how do you want to show that it's reverted, an animation? When the item B is dropped, item A is detached and returned to it's original position. – Twisty Jun 15 '18 at 23:44
  • Possible duplicate of https://stackoverflow.com/questions/35691702/jquery-drag-drop-revert-to-original-position-and-div-on-double-click/35711397 – Twisty Jun 15 '18 at 23:47
  • Thank you @Twisty. that link really helped. still i need an animation to show the reverting back. any idea how to achieve that? – Kaleem Nalband Jun 18 '18 at 07:57

0 Answers0