Sort multiple selected items in jQuery sortable?

前端 未结 2 791
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 22:14

I\'m trying to select more than one item in a jQuery sortable set and then move the selected items around together.

Here\'s my weak beginning of an atte

2条回答
  •  逝去的感伤
    2021-02-04 22:48

    This seems to work with the multisortable plugin. Code below. Or see jsFiddle.

    // ctrl + click to select multiple
    $('.container').multisortable({
        stop: function(e, ui) {
            var $group = $('.ui-multisort-grouped').not(ui.item);
            $group.clone().insertAfter($(ui.item));
            $group.each(function() {
                $(this).removeClass('ui-multisort-grouped');
            });
            $group.remove();
        }
    });
    

    But what if multisortable breaks with future jQuery versions?

提交回复
热议问题