Jquery Draggable - How do I create a new draggable div on the fly that can then be dragged?

后端 未结 2 721
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-09 01:26

I\'m creating a day planner using jquery, draggable and droppable.

When a job is dragged from the unassigned column into a hour time slot, the original draggable item i

2条回答
  •  攒了一身酷
    2021-02-09 01:38

    Simply apply draggable to the newly created DIV. If the DIV is exactly the same, except for position, you could also not recreate it, but just reposition it. This would retain all of it's handlers.

     // remove, reposition, reapply handlers
     $('#jobN').remove().appendTo('#dayViewN').draggable();
    

    or

     // reposition, retain handlers
     $('#jobN').appendTo('#dayViewN');
    

提交回复
热议问题