2009-02-05 19:39:38 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<title>jQuery UI Sortable - Connect lists with Tabs</title>
|
|
|
|
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
|
2009-02-20 11:40:25 +00:00
|
|
|
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
|
2009-02-05 19:39:38 +00:00
|
|
|
<script type="text/javascript" src="../../ui/ui.core.js"></script>
|
|
|
|
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
|
|
|
|
<script type="text/javascript" src="../../ui/ui.droppable.js"></script>
|
|
|
|
<script type="text/javascript" src="../../ui/ui.tabs.js"></script>
|
|
|
|
<link type="text/css" href="../demos.css" rel="stylesheet" />
|
|
|
|
<style type="text/css">
|
|
|
|
#sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
|
|
|
|
</style>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function() {
|
2009-02-05 21:44:38 +00:00
|
|
|
$("#sortable1, #sortable2").sortable().disableSelection();
|
2009-02-05 19:39:38 +00:00
|
|
|
|
2009-02-05 21:44:38 +00:00
|
|
|
var $tabs = $("#tabs").tabs();
|
2009-02-05 19:39:38 +00:00
|
|
|
|
2009-02-09 19:59:19 +00:00
|
|
|
var $tab_items = $("ul:first li",$tabs).droppable({
|
2009-02-05 19:39:38 +00:00
|
|
|
accept: ".connectedSortable li",
|
2009-02-09 11:13:42 +00:00
|
|
|
hoverClass: "ui-state-hover",
|
2009-02-05 19:39:38 +00:00
|
|
|
drop: function(ev, ui) {
|
2009-02-09 11:13:42 +00:00
|
|
|
var $item = $(this);
|
|
|
|
var $list = $($item.find('a').attr('href')).find('.connectedSortable');
|
2009-02-05 21:44:38 +00:00
|
|
|
|
2009-02-05 19:39:38 +00:00
|
|
|
ui.draggable.hide('slow', function() {
|
2009-02-09 11:13:42 +00:00
|
|
|
$tabs.tabs('select', $tab_items.index($item));
|
2009-02-05 21:44:38 +00:00
|
|
|
$(this).appendTo($list).show('slow');
|
2009-02-05 19:39:38 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="demo">
|
|
|
|
|
|
|
|
<div id="tabs">
|
|
|
|
<ul>
|
|
|
|
<li><a href="#tabs-1">Nunc tincidunt</a></li>
|
|
|
|
<li><a href="#tabs-2">Proin dolor</a></li>
|
|
|
|
</ul>
|
|
|
|
<div id="tabs-1">
|
|
|
|
<ul id="sortable1" class="connectedSortable ui-helper-reset">
|
|
|
|
<li class="ui-state-default">Item 1</li>
|
|
|
|
<li class="ui-state-default">Item 2</li>
|
|
|
|
<li class="ui-state-default">Item 3</li>
|
|
|
|
<li class="ui-state-default">Item 4</li>
|
|
|
|
<li class="ui-state-default">Item 5</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="tabs-2">
|
|
|
|
<ul id="sortable2" class="connectedSortable ui-helper-reset">
|
|
|
|
<li class="ui-state-highlight">Item 1</li>
|
|
|
|
<li class="ui-state-highlight">Item 2</li>
|
|
|
|
<li class="ui-state-highlight">Item 3</li>
|
|
|
|
<li class="ui-state-highlight">Item 4</li>
|
|
|
|
<li class="ui-state-highlight">Item 5</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div><!-- End demo -->
|
|
|
|
|
|
|
|
<div class="demo-description">
|
|
|
|
|
|
|
|
<p>
|
2009-02-05 19:48:10 +00:00
|
|
|
Sort items from one list into another and vice versa, by dropping the list item on the appropriate tab above.
|
2009-02-05 19:39:38 +00:00
|
|
|
</p>
|
|
|
|
|
|
|
|
</div><!-- End demo-description -->
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|