Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag item outside parent and into UI dialog

I have an "li class='draggable' " and a "div class='dropable' " that is inside a ui dialog div

when i try to drag the 'li' i can't drag it outside it's parent element so i did this :

$(".draggable").draggable({
                containment: $('document'),
                helper: 'clone'
            });

i managed to dragged outside it parent element but here where the problem start when the ui dialog is opened and when i try to drag it the li is always behind the ui dialog and i can't drop it into the droppable div

like image 521
Sora Avatar asked Oct 21 '22 14:10

Sora


1 Answers

Try appending the helper directly to the body, and possbly setting a zIndex, like so:

$(".draggable").draggable({
    appendTo: 'body', // Append to the body.
    zIndex: <someNumberYouThinkIsAppropriateHere>,
    containment: $('document'),
    helper: 'clone'
});

http://api.jqueryui.com/draggable/#option-appendTo

http://api.jqueryui.com/draggable/#option-zIndex

like image 113
Andrew Senner Avatar answered Oct 27 '22 09:10

Andrew Senner