4

如何使用溢出:自动将我的项目拖出#draggable div?下面的例子。

http://jsfiddle.net/7rmY3/1/

4

1 回答 1

3

使用选项:

'helper':'clone'

似乎让用户将项目拖出

http://jsfiddle.net/7rmY3/5/

编辑,

如果您需要删除拖动的项目,请在 droppable 方法的 drop 事件中进行。我应用了索引 id 来识别项目,但这可以通过不同的方式进行

$('#target').droppable({
    drop: function(event,ui){
               // Append the item in the droppable div
               $(this).append($(ui.draggable));       
               // Remove the item from the draggable list     
               $('#draggable li#'+$(ui.draggable).attr('id')).remove();
           }
});

http://jsfiddle.net/7rmY3/14/

于 2012-04-25T16:00:58.647 回答