使divs可拖动但在ui中使用jsPlumb包含 [英] Making Divs Draggable But Contained Using jsPlumb With YUI
问题描述
我正在尝试将jsPlumb与YUI框架结合使用,以使某些div可拖动和连接。但是,当我尝试使div可拖动但包含在其父级中时,我发现:
I'm trying to use jsPlumb with the YUI framework to make some divs draggable and connected. However, I find when I try to make the divs draggable but contained within their parent, using:
jsPlumb.draggable("window2", {
containment:"parent"
});
div仍可拖动到其父级的边界之外。如果将父级的CSS设置为溢出:隐藏,则将div拖动到父级边界之外时将看不到div,但我仍然会看到div的连接器,看起来确实很尴尬。
要在小提琴中查看全部内容,请执行以下操作: http://jsfiddle.net/xXYwX/3/
有人知道是否有一种方法可以在yui中使用jsPlumb的可拖动功能并且仍然限制可拖动div的移动吗?
the div is still draggable outside the bounds of its parent. If I set the parent's css to "overflow: hidden" I won't see the div when it's dragged beyond the parent's bounds but I'll still see the connector to the div, which looks really awkward. To see this all in a fiddle: http://jsfiddle.net/xXYwX/3/ Does anyone know if there is a way to use jsPlumb's draggable function with YUI and still restrict the movement of the draggable div?
谢谢!
推荐答案
首先使用jsPlumb使div可拖动:
First make the div draggable using jsPlumb:
jsPlumb.draggable("window2");
然后添加必要的jsPlumb端点:
Then add necessary jsPlumb end points:
jsPlumb.addEndpoint("window2", { ----});
然后添加可拖动的HTML,如
Then add the HTML draggable like
$('#window2').draggable({
containment: 'parent'
});
为我工作。.
这篇关于使divs可拖动但在ui中使用jsPlumb包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!