The JS API that framework wrappers abstract over. Use AnimatedDetails
for individual elements and DetailsGroup for accordion behavior.
.open(), .close(), .toggle() methods.This disclosure was initialized manually with new AnimatedDetails(el, { duration: 500, easing: 'ease-out' }). Use the buttons below to control it.
// Auto-init all [data-animated] and [data-disclosure-group]
Disclosures.autoInit();
// Manual init with defaults
var ad = new Disclosures.AnimatedDetails(el);
// Manual init with custom options
var ad = new Disclosures.AnimatedDetails(el, {
duration: 500,
easing: 'ease-out',
contentSelector: '.disclosure__content'
});
// Methods
ad.open();
ad.close();
ad.toggle();
ad.destroy();
.openByIndex(), .closeAll(), .destroy().Content for the first group item.
Content for the second group item.
Content for the third group item.
// Functional style — returns cleanup function
var cleanup = Disclosures.initDetailsGroup(container, {
exclusive: true
});
cleanup(); // remove listeners
// Class style — more control
var group = new Disclosures.DetailsGroup(container, {
exclusive: true
});
group.openByIndex(0);
group.closeAll();
group.destroy();