| 1 |
<!doctype html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<title>jQuery UI Sortable - Handle empty lists</title> |
| 5 |
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" /> |
| 6 |
<script type="text/javascript" src="../../jquery-1.3.2.js"></script> |
| 7 |
<script type="text/javascript" src="../../ui/ui.core.js"></script> |
| 8 |
<script type="text/javascript" src="../../ui/ui.sortable.js"></script> |
| 9 |
<link type="text/css" href="../demos.css" rel="stylesheet" /> |
| 10 |
<style type="text/css"> |
| 11 |
#sortable1, #sortable2, #sortable3 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; background: #eee; padding: 5px; width: 143px;} |
| 12 |
#sortable1 li, #sortable2 li, #sortable3 li { margin: 5px; padding: 5px; font-size: 1.2em; width: 120px; } |
| 13 |
</style> |
| 14 |
<script type="text/javascript"> |
| 15 |
$(function() { |
| 16 |
$("ul.droptrue").sortable({ |
| 17 |
connectWith: 'ul' |
| 18 |
}); |
| 19 |
|
| 20 |
$("ul.dropfalse").sortable({ |
| 21 |
connectWith: 'ul', |
| 22 |
dropOnEmpty: false |
| 23 |
}); |
| 24 |
|
| 25 |
$("#sortable1, #sortable2, #sortable3").disableSelection(); |
| 26 |
}); |
| 27 |
</script> |
| 28 |
</head> |
| 29 |
<body> |
| 30 |
<div class="demo"> |
| 31 |
|
| 32 |
<ul id="sortable1" class='droptrue'> |
| 33 |
<li class="ui-state-default">Can be dropped..</li> |
| 34 |
<li class="ui-state-default">..on an empty list</li> |
| 35 |
<li class="ui-state-default">Item 3</li> |
| 36 |
<li class="ui-state-default">Item 4</li> |
| 37 |
<li class="ui-state-default">Item 5</li> |
| 38 |
</ul> |
| 39 |
|
| 40 |
<ul id="sortable2" class='dropfalse'> |
| 41 |
<li class="ui-state-highlight">Cannot be dropped..</li> |
| 42 |
<li class="ui-state-highlight">..on an empty list</li> |
| 43 |
<li class="ui-state-highlight">Item 3</li> |
| 44 |
<li class="ui-state-highlight">Item 4</li> |
| 45 |
<li class="ui-state-highlight">Item 5</li> |
| 46 |
</ul> |
| 47 |
|
| 48 |
<ul id="sortable3" class='droptrue'> |
| 49 |
</ul> |
| 50 |
|
| 51 |
<br clear="both" /> |
| 52 |
|
| 53 |
</div><!-- End demo --> |
| 54 |
|
| 55 |
<div class="demo-description"> |
| 56 |
|
| 57 |
<p> |
| 58 |
Prevent all items in a list from being dropped into a separate, empty list |
| 59 |
using the <code>dropOnEmpty</code> option set to <code>false</code>. By default, |
| 60 |
sortable items can be dropped on empty lists. |
| 61 |
</p> |
| 62 |
|
| 63 |
</div><!-- End demo-description --> |
| 64 |
|
| 65 |
</body> |
| 66 |
</html> |
| 67 |
|