|
1 <!DOCTYPE html> |
|
2 <html lang="en"> |
|
3 <head> |
|
4 <meta charset="UTF-8" /> |
|
5 <title>jQuery UI Sortable - Include / exclude items</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 { list-style-type: none; margin: 0; padding: 0; zoom: 1; } |
|
15 #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 3px; width: 90%; } |
|
16 </style> |
|
17 <script type="text/javascript"> |
|
18 $(function() { |
|
19 $("#sortable1").sortable({ |
|
20 items: 'li:not(.ui-state-disabled)' |
|
21 }); |
|
22 |
|
23 $("#sortable2").sortable({ |
|
24 cancel: '.ui-state-disabled' |
|
25 }); |
|
26 |
|
27 $("#sortable1 li, #sortable2 li").disableSelection(); |
|
28 }); |
|
29 </script> |
|
30 </head> |
|
31 <body> |
|
32 <div class="demo"> |
|
33 |
|
34 <h3 class="docs">Specify which items are sortable:</h3> |
|
35 |
|
36 <ul id="sortable1"> |
|
37 <li class="ui-state-default">Item 1</li> |
|
38 <li class="ui-state-default ui-state-disabled">(I'm not sortable or a drop target)</li> |
|
39 <li class="ui-state-default ui-state-disabled">(I'm not sortable or a drop target)</li> |
|
40 <li class="ui-state-default">Item 4</li> |
|
41 </ul> |
|
42 |
|
43 <h3 class="docs">Cancel sorting (but keep as drop targets):</h3> |
|
44 |
|
45 <ul id="sortable2"> |
|
46 <li class="ui-state-default">Item 1</li> |
|
47 <li class="ui-state-default ui-state-disabled">(I'm not sortable)</li> |
|
48 <li class="ui-state-default ui-state-disabled">(I'm not sortable)</li> |
|
49 <li class="ui-state-default">Item 4</li> |
|
50 </ul> |
|
51 |
|
52 </div><!-- End demo --> |
|
53 |
|
54 <div class="demo-description"> |
|
55 |
|
56 <p> |
|
57 Specify which items are eligible to sort by passing a jQuery selector into |
|
58 the <code>items</code> option. Items excluded from this option are not |
|
59 sortable, nor are they valid targets for sortable items. |
|
60 </p> |
|
61 |
|
62 <p> |
|
63 To only prevent sorting on certain items, pass a jQuery selector into the |
|
64 <code>cancel</code> option. Cancelled items remain valid sort targets for |
|
65 others. |
|
66 </p> |
|
67 |
|
68 </div><!-- End demo-description --> |
|
69 |
|
70 </body> |
|
71 </html> |