https://jsfiddle.net/yv4wnmq4/5/
我被要求做一些拖放功能
screen shot 条件1
每个拖放元素将落在每个下拉框
上条件2
拖动后拖动元素应保持在同一位置 $(function () {
$(".container2").droppable({
drop: function(event, ui) {
var $this = $(this);
var itemid = $(event.originalEvent.toElement).attr("itemid");
var $dragged = ui.draggable,
$draggedClone = $dragged.clone();
$('.box-item').each(function() {
if ($(this).attr("itemid") === itemid) {
if ($this.find("div").attr("itemid") != itemid) {
$this.append($draggedClone);
}
}
});
}
});
$('.box-item').draggable({
cursor: 'move',
helper: "clone"
});
});