0
|
1 <!DOCTYPE html>
|
|
2 <html lang="en">
|
|
3 <head>
|
|
4 <meta charset="utf-8">
|
|
5 <title>jQuery UI Sortable - Connect lists</title>
|
|
6 <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
|
|
7 <script src="../../jquery-1.5.1.js"></script>
|
|
8 <script src="../../ui/jquery.ui.core.js"></script>
|
|
9 <script src="../../ui/jquery.ui.widget.js"></script>
|
|
10 <script src="../../ui/jquery.ui.mouse.js"></script>
|
|
11 <script src="../../ui/jquery.ui.sortable.js"></script>
|
|
12 <link rel="stylesheet" href="../demos.css">
|
|
13 <style>
|
|
14 #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; }
|
|
15 #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
|
|
16 </style>
|
|
17 <script>
|
|
18 $(function() {
|
|
19 $( "#sortable1, #sortable2" ).sortable({
|
|
20 connectWith: ".connectedSortable"
|
|
21 }).disableSelection();
|
|
22 });
|
|
23 </script>
|
|
24 </head>
|
|
25 <body>
|
|
26 <div class="demo">
|
|
27
|
|
28 <ul id="sortable1" class="connectedSortable">
|
|
29 <li class="ui-state-default">Item 1</li>
|
|
30 <li class="ui-state-default">Item 2</li>
|
|
31 <li class="ui-state-default">Item 3</li>
|
|
32 <li class="ui-state-default">Item 4</li>
|
|
33 <li class="ui-state-default">Item 5</li>
|
|
34 </ul>
|
|
35
|
|
36 <ul id="sortable2" class="connectedSortable">
|
|
37 <li class="ui-state-highlight">Item 1</li>
|
|
38 <li class="ui-state-highlight">Item 2</li>
|
|
39 <li class="ui-state-highlight">Item 3</li>
|
|
40 <li class="ui-state-highlight">Item 4</li>
|
|
41 <li class="ui-state-highlight">Item 5</li>
|
|
42 </ul>
|
|
43
|
|
44 </div><!-- End demo -->
|
|
45
|
|
46
|
|
47
|
|
48 <div class="demo-description">
|
|
49 <p>
|
|
50 Sort items from one list into another and vice versa, by passing a selector into
|
|
51 the <code>connectWith</code> option. The simplest way to do this is to
|
|
52 group all related lists with a CSS class, and then pass that class into the
|
|
53 sortable function (i.e., <code>connectWith: '.myclass'</code>).
|
|
54 </p>
|
|
55 </div><!-- End demo-description -->
|
|
56
|
|
57 </body>
|
|
58 </html>
|