0

I want to sort my items before I drop it.

this is my code

$(function () {
    $('.box').draggable({
        revert: true
    });
    $('.dest').droppable({
        accept: '.left .box',
        drop: function (event, ui) {
            $newElt = $('<div class="box"></div>');
            $newElt.appendTo(this);
        }
    });
    $(".dest").sortable();
});

this is a JSFiddle.

this is like what I want to do (Example)

1 Answers1

1

jsFiddle Demo

$(function () {
    $('.box').draggable({
        revert: true
    });
    $('.dest').droppable({
        accept: '.left .box',
        drop: function (event, ui) {
            $('.dest').sortable('refresh');
            $newElt = $('<div class="box"></div>');
            $newElt.appendTo(this);
        }
    });
    $(".dest").sortable({
        revert:50,
        forcePlaceholderSize: true
    });
});
animuson
  • 53,861
  • 28
  • 137
  • 147
DevlshOne
  • 8,357
  • 1
  • 29
  • 37