jQuery Sortable元素在排序过程中被“卡住”

时间:2018-09-11 08:43:31

标签: jquery jquery-ui

在这种情况下,我必须对dom元素进行排序,以便用户可以对元素进行排序。在某些情况下,当我尝试将其放置在所需位置时,它会卡住,如下所示。

enter image description here

下面是我用于排序的代码。

 $(sortableSelector).sortable({
    placeholder: "sc-highlight",
    tolerance: "pointer",
    cursorAt: { top: 25, left: 25 },
    connectWith: connectWithItem,
    handle: ".scw-move",
    forcePlaceholderSize: true,
    refreshPositions: true,
    revert: 450,
    items: sortableItems,
    //cancel: '.sce-redactor-init',
    start: function (event, ui) {

        ui.helper.addClass('started-sorting');
        ui.item.addClass('started-sorting');
        var startedSCPPanel1 = $(ui.helper).closest('div[class^="scp-panel"]');
        startedSCPPanel=startedSCPPanel1;
    },
    change: function () {
        console.log('asdf');
    },
    stop: function (event, ui) {
        ui.item.removeClass('started-sorting');           
    },
    beforeStop:function( event, ui ) {
        $( this ).attr( "src", "replacement.png" );
    }
});

在某些情况下,“ stop”和“ beforeStop”事件均不会触发。预先感谢您的帮助。

0 个答案:

没有答案