【发布时间】:2014-03-28 06:48:00
【问题描述】:
我在选项卡窗格内有一个可拖动的,它位于设置为溢出-y 的容器内:滚动。但是draggable不能被拖到容器外(这是必需的,因为放置目标在容器外!)。
HTML
<div class="container">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Header</a></li>
</ul>
<div id="tabs-1">
<div class="drag">
</div>
<p>Drag the pink box. It cannot go outside the gray container. If "overflow-y: scroll" is removed from its css, the box can be dragged outside.</p>
</div>
</div>
<p>
<div class="drag"></div> If the box is not inside of a tab, it can dragged outside the container.
</p>
</div>
CSS
.container {
height: 350px;
overflow-y: scroll;
background-color: #fafafa;
width: 75%;
}
.drag {
width: 20px;
height: 20px;
background-color: lightpink;
}
Javascript
$("#tabs").tabs();
$(".drag").draggable({helper: "clone"});
在http://jsfiddle.net/79u5a/2/试试这个
在我的应用程序中,我有各种这样的容器(具有溢出-y)并且每个容器都包含可拖动对象。除选项卡内的那些之外,所有可拖动对象都有效。 请告诉我一个解决方案。我需要能够将选项卡中的框拖到容器外。
【问题讨论】: