$("#source li").draggable({
appendTo: "#destination",
helper: "clone",
connectToSortable: "#destination",
containment: "document"
});
$("#destination").sortable({
items: "li:not(.placeholder)",
connectWith: "li",
placeholder: "dragging-placeholder",
sort: function() {
$(this).removeClass("ui-state-default");
},
over: function() {
$(".placeholder").hide();
},
out: function() {
if ($(this).children(":not(.placeholder)").length === 0) {
$(".placeholder").show();
}
}
});
JSFiddle:http://jsfiddle.net/j9FK5/7/
当我将几个框从源 UL 拖到目标时,它们变得非常难以排序,尤其是在尝试移至开头时。常规排序使用相同的 CSS。
我知道这是一个常见问题,但在这种特殊情况下,所有解决方案都不起作用。
最佳答案
您可以更改您的tolerance
选项并将其设置为指针
。
Specifies which mode to use for testing whether the item being moved is hovering over another item. Possible values:
"intersect": The item overlaps the other item by at least 50%.
"pointer": The mouse pointer overlaps the other item.
关于jquery-ui - jQuery UI 可拖动和可排序 - 难以排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22200069/