JQuery Dragging Outside Parent

前端 未结 5 2098
后悔当初
后悔当初 2020-12-20 11:31

I\'m using JQuery\'s draggable(); to make li elements draggable. The only problem is when the element is dragged outside its parent, it doesn\'t show up. That is, it doesn\'

5条回答
  •  暖寄归人
    2020-12-20 12:10

    I had also the same problem.
    You can use this option

    containment: $('#divmain')
    helper: 'clone'

    respectively for
    - define limit area for dropping action
    - for shows visible dragged object also outside div parent but inside #divmain

    example

    jquery code:

    $('divparentdraggable').draggable({ 
    ...
    containment: $('#divmain'),
    helper: 'clone',
    ...
    });
    

    I hope this help someone.

提交回复
热议问题