jQuery UI drop on empty container/list not working

前端 未结 4 1614
野趣味
野趣味 2020-12-18 06:21

I have a problem with the jQuery UI sortable widget. I simply can\'t drop any item on an empty container. When the container has an item it works perfectly. I call the widg

4条回答
  •  执笔经年
    2020-12-18 07:12

    WORKING FIDDLE

    Basically, you were setting the sortable on the wrong element. I change it to the .apc_column--content element and now it works. Since both lists have that class I also had to change the connectWith property to that as well.

    Cheers.

    $(".apc_column--content").sortable({
                placeholder: 'apc_drop-placeholder-blocked',
                forcePlaceholderSize: true,
                items: '.apc_inner_item',
                connectWith: ".apc_column--content",
                tolerance: "pointer",
                dropOnEmpty: true,
                distance: 0.5,
                stop: function(event, ui){
                    // that.droppedItem(ui.item, ui.item.index());
                }
    });
    

提交回复
热议问题