Prevent drop of list item in JqueryUI sortable

前端 未结 8 2049
情歌与酒
情歌与酒 2020-12-23 22:19

I have two lists #sortable1 and #sortable 2 which are connected sortables, as shown in this example.

You can drag and drop list items from

8条回答
  •  抹茶落季
    2020-12-23 22:36

    If a) you only have just these 2 lists, and b) you don't care that your "number" actually be dragged and then drop back, you can simply prevent it from getting dragged by this:

     sort: function(event, ui) {
    if(ui.item.hasClass('number')) return false;
    }
    

提交回复
热议问题