Sowmya
Sowmya

Reputation: 26969

Close all the items in accordion menu

I need all the menus to be closed by default in accordion menu. Here is the script which I am using, here 1st tab will be opened by default. How do I get every tab closed by default

<script type="text/javascript">
            $('#accrdion').accordion();          
        </script>

Upvotes: 1

Views: 1526

Answers (1)

Richard
Richard

Reputation: 8280

Assuming you're using the jQuery-UI accordion, you can collapse all by enabling collapsible, and then using the method activate with a value of false, like this:

// construct the accordion
$('#accrdion').accordion({
    collapsible: true
});

// collapse all somewhere else
$('#accrdion').accordion('activate', false);

Upvotes: 4

Related Questions