从一个列表中拖放 jQuery UI 可拖动元素并将其放入另一个列表的问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/528787/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 09:16:55  来源:igfitidea点击:

Issues with dragging and dropping jQuery UI draggable element from one list and put it into an other

jqueryjquery-uidrag-and-dropjquery-ui-draggablejquery-ui-droppable

提问by user63371

I am using jQuery UIand can create an simple drag 'n drop list. But now, I want to drop the element into an other list. jQuery always thinks the item has been droppen on the false place and slides it back into the origin list.

我正在使用jQuery UI并且可以创建一个简单的拖放列表。但是现在,我想将该元素放入另一个列表中。jQuery 总是认为该项目已被放置在错误的位置并将其滑回原点列表。

回答by Frost

I think the solution is found here: http://ui.jquery.com/demos/sortable/#connect-lists

我认为可以在这里找到解决方案:http: //ui.jquery.com/demos/sortable/#connect-lists

and its done something like this:

它做了这样的事情:

$(function() {
        $("#sortable1, #sortable2").sortable({
            connectWith: ['.connectedSortable']
        });
    });