jQuery UI & Tabs: Sortable tabs

jQuery UI Tabs – Sortable

Drag the tabs above to re-order them.

Making tabs sortable is as simple as calling .sortable() on the .ui-tabs-nav element.

<!doctype html>
<html lang='en'>
<head>
    <meta charset='utf-8'>
    <title>jQuery UI Tabs - Sortable</title>
    <link rel='stylesheet' href='//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css'>
    <script src='//code.jquery.com/jquery-1.10.2.js'></script>
    <script src='//code.jquery.com/ui/1.10.4/jquery-ui.js'></script>
    <link rel='stylesheet' href='https://codecrawl.com/code/jqueryui/jqueryui_style.css'>
    <script>
        $(function () {
            var tabs = $('#tabs').tabs();
            tabs.find('.ui-tabs-nav').sortable({
                axis: 'x',
                stop: function () {
                    tabs.tabs('refresh');
                }
            });
        });
    </script>
</head>
<body>

<div id='tabs'>
    <ul>
        <li><a href='#tabs-1'>Pitbull</a></li>
        <li><a href='#tabs-2'>Sean Kingston</a></li>
        <li><a href='#tabs-3'>Taylor Swift</a></li>
    </ul>
    <div id='tabs-1'>
        <p>Pitbull is a Cuban–American recording artist and Latin Grammy winning rapper from Miami, Florida.</p>
    </div>
    <div id='tabs-2'>
        <p>Sean Kingston pursued a music career and debuted in 2007 with the album Sean Kingston.</p>
    </div>
    <div id='tabs-3'>
        <p>Taylor Swift, raised in Wyomissing, Pennsylvania. She moved to Nashville, Tennessee at the age of
            fourteen.</p>

        <p>She is known for her narrative songs about her personal experiences.</p>
    </div>
</div>

</body>
</html>
Try The Code
Series Navigation<< jQuery UI & Tabs: Open on mouseover
jQuery UI & Tabs: Tabs adding and removing >>