Reputation: 12327
I have a div with images; the images needs to draggable to a div board.
My problem is if there are to much images (so overflow will show) the images can't be dragged outside the div. If there is no overflow its all good but with overflow the site fails.
I use:
overflow-y:scroll;
to keep the layout the same all the time so there will always be overflow.
How can i avoid this overflow problem?
without overflow: http://jsfiddle.net/Z7Ume/1/
my example with overflow: http://jsfiddle.net/Z7Ume/
Upvotes: 1
Views: 552
Reputation: 30993
By default, the drag helper is appended to the same container as the draggable. You can specify the appendTo
option, it will be used as the draggable helper's container for dragging.
Example:
$(".Item").draggable({
helper: "clone",
containment: "#Inhoud",
revert: "invalid",
appendTo: "body"
});
Doc: http://api.jqueryui.com/draggable/#option-appendTo
Working fiddle: http://jsfiddle.net/Z7Ume/3/
Similar question: jQuery Draggable and overflow issue
Upvotes: 3