r2021 - trunk/demos/sortable

r2021 - trunk/demos/sortable


Author: bohdan.ganicky
Date: Thu Feb 5 13:44:38 2009
New Revision: 2021
Modified:
trunk/demos/sortable/connect-lists-through-tabs.html
Log:
demos/sortable/connect-lists-through-tabs: finetuning + automatic tab
switch after item is removed from the list
Modified: trunk/demos/sortable/connect-lists-through-tabs.html
==============================================================================
--- trunk/demos/sortable/connect-lists-through-tabs.html    (original)
+++ trunk/demos/sortable/connect-lists-through-tabs.html    Thu Feb 5
13:44:38 2009
@@ -14,17 +14,19 @@
    </style>
    <script type="text/javascript">
    $(function() {
-        $("#sortable1, #sortable2").sortable({
-        }).disableSelection();
+        $("#sortable1, #sortable2").sortable().disableSelection();
-        $("#tabs").tabs();
+        var $tabs = $("#tabs").tabs();
-        $("#tabs a").droppable({
+        var $tab_links = $("a",$tabs).droppable({
            accept: ".connectedSortable li",
            drop: function(ev, ui) {
-                var $target = $($(this).attr('href')).find('.connectedSortable');
+                var $link = $(this);
+                var $list = $($link.attr('href')).find('.connectedSortable');
+
                ui.draggable.hide('slow', function() {
-                    $(this).prependTo($target).show();
+                    $tabs.tabs('select', $tab_links.index($link));
+                    $(this).appendTo($list).show('slow');
                });
            }
        });