外面溢出不可拖动

时间:2013-04-08 11:23:52

标签: jquery jquery-ui

我有图像的div;图像需要可以拖动到div板上。

我的问题是,如果有太多图像(因此会显示溢出),图像无法拖到div之外。 如果没有溢出它的全部好处但溢出会导致站点失败。

我用:

 overflow-y:scroll;

始终保持布局相同,以便始终存在溢出。

如何避免这种溢出问题?

没有溢出:http://jsfiddle.net/Z7Ume/1/

我的溢出示例:http://jsfiddle.net/Z7Ume/

1 个答案:

答案 0 :(得分:3)

默认情况下,拖动助手会附加到与可拖动对象相同的容器中。您可以指定appendTo选项,它将用作可拖动帮助程序的拖动容器。

示例:

$(".Item").draggable({
    helper: "clone",
    containment: "#Inhoud",
    revert: "invalid",
    appendTo: "body"
});

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

工作小提琴:http://jsfiddle.net/Z7Ume/3/

类似的问题:jQuery Draggable and overflow issue

相关问题