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