【发布时间】:2017-12-04 08:03:23
【问题描述】:
当我同时使用jquery-ui resizable 和draggable 时遇到问题。下面提到的是问题发生时的场景:
先移动父级Div,
然后调整子 Div 的大小。
最后子 Div 显示不正确
如果我删除了可调整大小的containment 选项,就可以了。
我发现选项 containment andhelper` 不能同时存在。
谢谢
这里是演示
// external js: draggabilly.pkgd.js
$('.father').draggable({
handle:'.p1'
}).resizable({
helper: "ui-resizable-helper",
containment: "parent"
});
$('.child').draggable({
handle:'.p2'
}).resizable({
helper: "ui-resizable-helper",
containment: "parent"
});
body { font-family: sans-serif; }
.draggable {
width: 300px;
height: 300px;
background: #F90;
border-radius: 10px;
}
.draggable.is-pointer-down {
background: #09F;
}
p{ background: #F00;}
.child {
width:100px;
height:100px;
}
.draggable.is-dragging { opacity: 0.7; }
.ui-resizable-helper{ border: 1px dotted #20a0ff; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<link href="https://jqueryui.com/resources/demos/style.css" rel="stylesheet"/>
<div class="draggable ui-widget-content father ">
<p class ="p1">handle</p>
<div id="resizable" class="draggable ui-widget-content child">
<p class ="p2">handle</p>
1234345 6
</div>
</div>
【问题讨论】:
-
我使用其他可拖动库,jqUI resizable 也无法正常工作,所以我认为 jqUI resizable 有一个错误。你能帮帮我吗?
标签: javascript jquery jquery-ui jquery-ui-draggable jquery-ui-resizable