how to revert position of a jquery UI draggable based on condition

前端 未结 5 2013
孤独总比滥情好
孤独总比滥情好 2020-12-08 04:54

I have an element which is draggable and an element which is droppable. Once the dragged item is dropped on the dropzone I am trying to execute the following jquery psuedo c

5条回答
  •  悲哀的现实
    2020-12-08 05:02

    I found that if I simply set top:0 and left:0, the item is no longer draggable. In order to "force" a revert I had to do this:

    $draggedObj.css({ top: 0, left: 0 })
    $draggedObj.draggable( "destroy" )
    $draggedObj.draggable({...whatever my draggable options are...});
    

提交回复
热议问题