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