jquery ui sortables connect lists: copy items

前端 未结 2 1613
悲&欢浪女
悲&欢浪女 2020-12-28 10:19

I have two lists, I want both of them to be sortable and want to be able to copy (drag) items from list1 to list2 and vice versa.

http://jqueryui.com/demos/sortable/

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-28 11:04

    I have to say that FFish's answer to this has been incredibly helpful to me.

    I'd make one suggestion; if the lists are being constantly changed the mousedown event seem to be called numerous times because of the re-registering of the event on all the child objects. It might be a bit of a kludge, but I've added an unbind first to ensure the mousedown event is only called once.

        $(".album li").mousedown(mStart);
    

    to

        $(".album li").unbind('mousedown', mStart).mousedown(mStart);
    

提交回复
热议问题