我正在使用以下代码
var $albumcover = $('#albumcover');
<br>
$albumcover.droppable({
<br>
accept: '#trash2 li',
<br>
activeClass: 'ui-state-highlight',
drop: function(ev, ui) {
<br>
$(this).append($(ui.draggable).clone().attr('alt', 'nat'));
<br>
$(this).find('img').css('width','100px');
<br>
$(this).find('img').css('height','100px');
}
});
我怎么能
在创建克隆元素时将事件添加到克隆元素中,以便它可以再次拖动...
答案 0 :(得分:1)
替换
$(this).append($(ui.draggable).clone().attr('alt', 'nat'));
与
$(this).append($(ui.draggable).clone(true).attr('alt', 'nat'));
真值用于
克隆匹配的DOM元素及其所有事件处理程序,然后选择克隆。
阅读文档