更新时间:2022-10-14 19:16:05
You need to pass the containment option:
$(function() {
$( ".sortable" ).sortable({
axis: 'y',
containment: "parent"
}).disableSelection();
});
Here is a working example with the code: http://jsfiddle.net/VzpBq/
Definition of the containment
option from the Sortable jQueryUI API:
Defines a bounding box that the sortable items are contrained to while dragging.