jquery-ui - jQuery UI 可拖动和可排序 - 难以排序

标签 jquery-ui jquery-ui-sortable jquery-ui-draggable

$("#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.

演示:http://jsfiddle.net/Fs772/

关于jquery-ui - jQuery UI 可拖动和可排序 - 难以排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22200069/

相关文章:

javascript - 连接两个 jquery-ui sortables,如何更改可放置目标?

JQueryUI - 可调整大小迫使我的 div 从位置 :Relative to Absolute 切换

javascript - 如何在 JavaScript 中捕获 dragend 事件?

jquery - 如何从 AngularJS Controller 正确调用 jQuery

javascript - JqueryUI Datepicker 不会将选定的日期放入 HTML

jquery-ui - jQuery DatePicker 太大

javascript - 将包含应用于 jQuery UI 可排序表可防止将高行移动到最后一个位置

jqueryui datepicker,比较两个日期并调整大于或小于

javascript - 拼词游戏,正确则提醒

jQuery 可放置鼠标悬停传播