How to auto apply drag and drop effect to dynamically added element?

前端 未结 3 747
Happy的楠姐
Happy的楠姐 2021-01-27 16:51

I use jquery ui to apply a drag and drop effect on a serial of DIVs, for example:

...
.
3条回答
  •  失恋的感觉
    2021-01-27 17:40

    You cannot use the .live() function with .draggable() directly, but you can use .live() with the mouseover event and re-attach .draggable() on mouseover like this.

    $('.draggable').live('mouseover',function(){
        $(this).draggable();
    });
    

提交回复
热议问题