Cancel dragging of a sortable item

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

An absolutely common sortable case:



  • Item
4条回答
  •  情书的邮戳
    2021-02-04 01:17

    Returning false as fudgey suggests works great for making things dynamically unsortable, but there's also a cancel option in the sortable config which lets you set up static unsortables as well:

    $("#sortable").sortable({
        // this prevents all buttons, form fields, and elemens
        // with the "unsortable" class from being dragged
        cancel: ":input, button, .unsortable"
    });
    

提交回复
热议问题