It is possible do disable jquery ui sortable just for one list item? Here is the code example:
- Item 1
This question has two similar answers... but their behavior is very different.
Using cancel, you can make item sortable / not-sortable dynamically:
$(".sortable_cancel").sortable({
cancel: ".unsortable"
});
Using items, you can make item sortable / not-sortable but only at initialization time:
$(".sortable_item").sortable({
items: "li:not(.unsortable)"
});
See the difference in this demo:
$(".sortable_cancel").sortable({
cancel: ".unsortable"
});
$(".sortable_cancel").disableSelection();
$(".sortable_item").sortable({
items: "li:not(.unsortable)"
});
$(".sortable_item").disableSelection();
.sortable {
list-style-type: none;
width: 60%;
padding: 5px;
}
.sortable li {
padding-left: 1.5em;
}
li.unsortable {
background: #999;
opacity:.5;
}
- Item1
- Item2
- Item3
- Item4
- Item5
- Item1
- Item2
- Item3
- Item4
- Item5