当我将一些div放入可排序的窗格时,我只能在第二次点击它们之后抓取新创建的div。 我想这是一个与刷新相关的问题,但我无法弄清楚如何使它工作。
以下是jsfiddle:http://jsfiddle.net/DvE5Q/ 代码:
$(".box").draggable({
helper: 'clone'
});
$("#left").droppable({
accept: '.box.out',
drop: function (e, ui) {
$(this).append('<div class="box"></div>');
var droppedBox = $(this).children().last();
$(droppedBox).html(ui.helper.html());
}
});
$("#left").sortable();
感谢您的帮助!
答案 0 :(得分:1)
我会使用属性connectToSortable: '#left'
DEMO http://jsfiddle.net/DvE5Q/1/
$(".box").draggable({
helper: 'clone',
connectToSortable: '#left'
});
$("#left").droppable({
accept: '.box.out',
drop: function (e, ui) {
}
});
$("#left").sortable();