3

enter image description here

While dragging a <div> for sorting, if I drag the any box outside of container it comes outside of container <div>. I don't want this.

I except the output is while Sorting, the dragging (ex. above green background div) <div> should not comes outside of parent/Container DIV.

Demo link

$(function () {
  $(".drag_wrapper").sortable({
    connectWith: ".drag_wrapper"
  }).disableSelection();
});
T J
  • 42,762
  • 13
  • 83
  • 138
ItzMe_Ezhil
  • 1,276
  • 2
  • 11
  • 22

1 Answers1

5

I think you are looking for the containment option:

$(function () {
    $(".drag_wrapper").sortable({
        connectWith: ".drag_wrapper",
        containment: ".drag_wrapper"
    }).disableSelection();
});
rdubya
  • 2,916
  • 1
  • 16
  • 20