5 <title>jQuery UI Sortable - Connect lists with Tabs</title>
6 <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7 <script src="../../jquery-1.9.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 <script src="../../ui/jquery.ui.droppable.js"></script>
13 <script src="../../ui/jquery.ui.tabs.js"></script>
14 <link rel="stylesheet" href="../demos.css">
16 #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
20 $( "#sortable1, #sortable2" ).sortable().disableSelection();
22 var $tabs = $( "#tabs" ).tabs();
24 var $tab_items = $( "ul:first li", $tabs ).droppable({
25 accept: ".connectedSortable li",
26 hoverClass: "ui-state-hover",
27 drop: function( event, ui ) {
28 var $item = $( this );
29 var $list = $( $item.find( "a" ).attr( "href" ) )
30 .find( ".connectedSortable" );
32 ui.draggable.hide( "slow", function() {
33 $tabs.tabs( "option", "active", $tab_items.index( $item ) );
34 $( this ).appendTo( $list ).show( "slow" );
45 <li><a href="#tabs-1">Nunc tincidunt</a></li>
46 <li><a href="#tabs-2">Proin dolor</a></li>
49 <ul id="sortable1" class="connectedSortable ui-helper-reset">
50 <li class="ui-state-default">Item 1</li>
51 <li class="ui-state-default">Item 2</li>
52 <li class="ui-state-default">Item 3</li>
53 <li class="ui-state-default">Item 4</li>
54 <li class="ui-state-default">Item 5</li>
58 <ul id="sortable2" class="connectedSortable ui-helper-reset">
59 <li class="ui-state-highlight">Item 1</li>
60 <li class="ui-state-highlight">Item 2</li>
61 <li class="ui-state-highlight">Item 3</li>
62 <li class="ui-state-highlight">Item 4</li>
63 <li class="ui-state-highlight">Item 5</li>
68 <div class="demo-description">
69 <p>Sort items from one list into another and vice versa, by dropping the list item on the appropriate tab above.</p>