【发布时间】:2013-10-31 16:26:35
【问题描述】:
我想让图像在给定的 div 上可拖动。我想使用小图像的克隆将其拖放到 div 中。我的代码是
HTML
<div class="option" id="f">
<img class="options" src="http://lorempixel.com/output/people-h-g-49-66-3.jpg" alt=""/>
</div>
<div class="lame">
<img src="http://placehold.it/350x150" alt=""/>
</div>
jQuery
$(function() {
$( ".options" ).draggable({ cursor: "pointer",opacity: 0.6,helper: "clone"
});
$(".lame").droppable({ accept:".options"
});
});
如果我不使用帮助器:“克隆”,此代码可以正常工作。使用新的 jQuery 和 jQuery ui 版本正确执行此拖放过程的正确方法是什么。 Jsfiddle is here。
【问题讨论】:
标签: jquery jquery-ui drag-and-drop jquery-ui-draggable