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