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