Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sortable tabs in jquery Sortable

In this example http://jqueryui.com/sortable/#connect-lists-through-tabs it has connected lists through tabs. How can i have sortable tabs?

like image 361
user2771714 Avatar asked Mar 21 '23 07:03

user2771714


1 Answers

It is possible like in this example in JSFiddle

$(function() {
    var tabs = $( "#tabs" ).tabs();
    tabs.find( ".ui-tabs-nav" ).sortable({
      axis: "x",
      stop: function() {
        tabs.tabs( "refresh" );
      }
    });
  });  
    $(function() {
    $( "#sortable1, #sortable2" ).sortable().disableSelection();

    var $tabs = $( "#tabs" ).tabs();

    var $tab_items = $( "ul:first li", $tabs ).droppable({
      accept: ".connectedSortable li",
      hoverClass: "ui-state-hover",
      drop: function( event, ui ) {
        var $item = $( this );
        var $list = $( $item.find( "a" ).attr( "href" ) )
          .find( ".connectedSortable" );

        ui.draggable.hide( "slow", function() {
          $tabs.tabs( "option", "active", $tab_items.index( $item ) );
          $( this ).appendTo( $list ).show( "slow" );
        });
      }
    });
  });
like image 191
user2771714 Avatar answered Apr 05 '23 01:04

user2771714