【发布时间】:2016-10-30 10:49:40
【问题描述】:
我创建了 2 个 div,我想将第一个 div 的克隆拖放到第二个 div 中。问题是克隆在我拖动它时消失了,但是一旦它被放到第二个 div 中就会出现。
html代码:
<div id="green" class="editable"></div>
<div id="container"></div>
jQuery 代码:
$(document).ready(function(){
$(".editable").draggable({helper:'clone'});
$(".editable").resizable();
$("#container").droppable({
drop: function(event,ui){
$(this).append($(ui.draggable).clone());
}
});
});
另外,我在 head 部分包含以下内容:
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
提前致谢。
【问题讨论】:
-
你能创建一个 plunker 吗?
标签: javascript jquery html jquery-ui jquery-ui-draggable