Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

jQuery Accordion


May 07, 2021 jQuery


Table of contents


jQuery Accordion

The jQuery Accordion plug-in is used to create collapsed menus. I t is typically used with nested lists, defined lists, or nested divs. Options to specify structures, activated elements, and custom animations.

The plug-in is now part of the jQuery UI and the standalable version will not be updated. T he current version is 1.6. jQuery Accordion website

To learn more about Accordion, check out the API documentation Collapse Panel Part ( Accordion Widget).

Standard

The standard code is as follows:

jQuery('#list1a').accordion(); jQuery('#list1b').accordion({ 
    autoheight: false });

Navigation

A sequenceless table with anchors and nested lists

jQuery('#navigation').accordion({ 
    active: false, 
    header: '.head', 
    navigation: true, 
    event: 'mouseover', 
    fillSpace: true, 
    animated: 'easeslide' });

with options

A container is a list of definitions with a title of dt and a content of dd.

jQuery('#list2').accordion({ 
    event: 'mouseover', 
    active: '.selected', 
    selectedClass: 'active', 
    animated: "bounceslide", 
    header: "dt" }).bind("change.ui-accordion"function(event, ui{ 
    jQuery('<div>' + ui.oldHeader.text() + ' hidden, ' + ui.newHeader.text() + ' shown</div>').appendTo('#log'); });

Read about it

jQuery EasyUI Tutorial: jQuery EasyUI Layout - Create a collapsed panel