Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Ui: Cant drag element from Div with overflow

I have a simple UL in a div with the overflow set to automatic and a fixed height. Each LI is draggable via jQuery. Problem is that I cannot drag them from the div (they disappear when dragged to the boundaries).

I have looked at this question and its answers, but the solution here does not seem to work for me (setting the scroll option): jQuery Draggable and overflow issue

Thanks

like image 524
Sergio Avatar asked Nov 30 '09 12:11

Sergio


2 Answers

I got around this by using a helper method to append the item to the body (so its outside the div)

$("#myitem").draggable({
helper: function() { return $(this).clone().appendTo('body').show(); }
});

Not sure if you need the show() and I also had to raise the z-index but it depends on the rest of your page.

Phil

like image 173
Phil Avatar answered Oct 21 '22 00:10

Phil


I was able to achieve the same results with

appendTo: 'body',
helper: 'clone'
like image 40
Chris Wininger Avatar answered Oct 21 '22 01:10

Chris Wininger