Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Accordion

jQuery Accordion

The jQuery Accordion plugin is used to create collapsible menus. It is typically used with nested lists, definition lists, or nested divs. Options specify the structure, the active element, and custom animations.

This plugin is now part of jQuery UI , and the standalone version will no longer be updated. The current version is 1.6.

jQuery Accordion Official Site, download the jQuery Accordion plugin:http://www.runoob.com/try/download/jquery-accordion.zip.

For more details about Accordion, see the API documentation Accordion Widget.

Standard

The standard code is as follows:



jQuery('#list1a').accordion(); 

jQuery('#list1b').accordion({ 

    autoheight: false 

});

navigation

An unordered list with anchors and nested lists



jQuery('#navigation').accordion({ 

    active: false, 

    header: '.head', 

    navigation: true, 

    event: 'mouseover', 

    fillSpace: true, 

    animated: 'easeslide' 

});

With Options

The container is a definition list, with dt as the title and dd as the content.



jQuery('#list2').accordion({ 

    event: 'mouseover', 

    active: '.selected', 

    selectedClass: 'active', 

    animated: "bounceslide", 

    header: "dt" 

}).bind("change.ui-accordion", function(event, ui) { 

    jQuery('
' + ui.oldHeader.text() + ' hidden, ' + ui.newHeader.text() + ' shown
').appendTo('#log'); });