jQuery UI & Accordion: Sortable

This entry is part 2 of 7 in the series jQuery UI Accordion

jQuery UI Accordion – Sortable

You can drag the header to re-order panels.

<!doctype html>
<html lang='en'>
    <meta charset='utf-8'>
    <title>jQuery UI Accordion - 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.9.1.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'>
        /* IE has layout issues when sorting (see #5413) */
        .group {
            zoom: 1
        $(function () {
                        header: '> div > h3'
                        axis: 'y',
                        handle: 'h3',
                        stop: function (event, ui) {
                            // IE doesn't register the blur when sorting
                            // so trigger focusout handlers to remove .ui-state-focus

<div id='accordion'>
    <div class='group'>
        <h3>Section 1</h3>

            <p>Content of section 1.</p>
    <div class='group'>
        <h3>Section 2</h3>

            <p>Content of section 2.</p>
    <div class='group'>
        <h3>Section 3</h3>

            <p>Content of section 3.</p>
                <li>List item one</li>
                <li>List item two</li>
                <li>List item three</li>
    <div class='group'>
        <h3>Section 4</h3>

            <p>Content of section 4</p>

Try The Code

Series Navigation<< jQuery UI & Accordion: Displaying Collapsible Content Panels
jQuery UI & Accordion: Allow All Sections To Be Collapsible >>