How do I duplicate item when using jquery sortable?

后端 未结 6 618
孤街浪徒
孤街浪徒 2020-11-29 20:16

I am using this method http://jqueryui.com/demos/sortable/#connect-lists to connect two lists that i have. I want to be able to drag from list A to list B but when the item

6条回答
  •  时光说笑
    2020-11-29 20:52

    $("#sortable1").sortable({
        connectWith: ".connectedSortable",
        forcePlaceholderSize: false,
        helper: function (e, li) {
            copyHelper = li.clone().insertAfter(li);
            return li.clone();
        },
        stop: function () {
            copyHelper && copyHelper.remove();
        }
    });
    $(".connectedSortable").sortable({
        receive: function (e, ui) {
            copyHelper = null;
        }
    });
    

提交回复
热议问题