JQuery UI - Draggable and Sortable inside container / parent Div
When dragging <div>
to sort, if I drag any field outside of the container, it goes outside of the container <div>
. I do not want it.
I am other than outputting while sorting, dragging (e.g. over a green background div) <div>
should not go outside the parent / container of the DIV.
$(function () {
$(".drag_wrapper").sortable({
connectWith: ".drag_wrapper"
}).disableSelection();
});
+3
source to share
1 answer
I think you are looking for containment :
$(function () {
$(".drag_wrapper").sortable({
connectWith: ".drag_wrapper",
containment: ".drag_wrapper"
}).disableSelection();
});
+4
source to share