Cancel dragging of a sortable item

后端 未结 4 483
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 00:16

An absolutely common sortable case:



  • Item
4条回答
  •  一个人的身影
    2021-02-04 01:21

    Sortable has a "cancel" capability invoked using sortable('cancel').

    From the docs: "Cancels a change in the current sortable and reverts it to the state prior to when the current sort was started." See http://api.jqueryui.com/sortable/#method-cancel.

    Example usage:

    $("#sortable").sortable({
      stop: function(e, ui) {
        if ("I need to cancel this") {
          $(ui.sender).sortable('cancel');
        }
      }
    });
    

提交回复
热议问题