demos/sortable/connect-lists-through-tabs: finetuning + automatic tab switch after item is removed from the list

This commit is contained in:
Bohdan Ganicky 2009-02-05 21:44:38 +00:00
parent 915a3a4117
commit 81099914a9

View File

@ -14,17 +14,19 @@
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$("#sortable1, #sortable2").sortable({ $("#sortable1, #sortable2").sortable().disableSelection();
}).disableSelection();
$("#tabs").tabs(); var $tabs = $("#tabs").tabs();
$("#tabs a").droppable({ var $tab_links = $("a",$tabs).droppable({
accept: ".connectedSortable li", accept: ".connectedSortable li",
drop: function(ev, ui) { 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() { ui.draggable.hide('slow', function() {
$(this).prependTo($target).show(); $tabs.tabs('select', $tab_links.index($link));
$(this).appendTo($list).show('slow');
}); });
} }
}); });