Displays collapsible content panels for presenting information in a limited amount of space.
CSSMIT
jQuery Accordion (version : v1.0.0)
A lightweight jQuery Accordion plugin helps to display collapsible content panels for presenting information when the amount of space is limited. Easy to manage show/hide animation speed. It's use jQuery animation method to support for older browsers.
It's also provide many configurable parametes and built in functions. (refer: parameters and method sections.)
<divid="acord1" class="acord"><h3class="acord_head">Section 1</h3><divclass="acord_cont">
Section1
</div><h3class="acord_head">Section 2</h3><divclass="acord_cont">
Section2
</div><h3class="acord_head">Section 3</h3><divclass="acord_cont">
Section3
</div></div>
(Note : Each content panel (having class "acord_cont") must always be the next sibling after its associated header (having class "acord_head")
Add Plugin Call
$('#acord1').accordion();
Include the Style Sheet(accordion.css)
Include the suggestor javascript library(accordion.js) & updated jQuery liberary
Parameters (Options)
Name
Default Value
Discription
active
0
Which panel is currently open. (Setting active to false will active zero-based index of the panel and true will active first index of the panel. The zero-based index of the panel that is active (open). A negative value selects panels going backward from the last panel.)
openEvent
'click'
Any event (e.g. 'keypress','mouseover')
collapsible
false
Whether all the sections can be closed at once. Allows collapsing the active section.
previousOpen
false
if true then previous section remain open while active to other section.
showHideSpeed
'slow'
'slow' or 'medium' or 'fast' or an interger value (in miliseconds) e.g. 2000
allOpen
false
Whether to show all section open(active) at once. Allows collapsing to each section.
icons to use for headers. Set to false to have no icons displayed.
onClick or callBack
null
Triggered after a panel has been activated.
Methods
Name
Discription
enabled
If call with no arguments then enabled all sections of accordion, if pass a single argument as an interger/string then enabled the given index section , if argument pass as an array of intergers then enabled only matched indexes sections.
disabled
If call with no arguments then disabled all sections of accordion, if pass a single argument as an interger/string then disabled the given index section , if argument pass as an array of intergers then disabled only matched indexes sections.
collapse
If call with no arguments then collapse all sections of accordion, if pass a single argument as an interger/string then collapse the given index section , if argument pass as an array of intergers then collapse only matched indexes sections.
expand
If call with no arguments then expend all sections of accordion, if pass a single argument as an interger/string then expend the given index section , if argument pass as an array of intergers then expand only matched indexes sections.
varaccord=$(".selector").accordion();accord.expand();// expand all sectionsoraccord.expand(1);// expand only first index.oraccord.expand([1,3]);// espand first and third index sections.Note : indexstartsfromzero.
collapse()
varaccord=$(".selector").accordion();accord.collapse();// collapse all sectionsoraccord.collapse(1);// collapse only first index.oraccord.collapse([1,3]);// espand first and third index sections.Note : indexstartsfromzero.
disabled()
varaccord=$(".selector").accordion();accord.disabled();// disabled all sectionsoraccord.disabled(1);// disabled only first index.oraccord.disabled([1,3]);// espand first and third index sections.Note : indexstartsfromzero.
enabled()
varaccord=$(".selector").accordion();accord.enabled();// enabled all sectionsoraccord.enabled(1);// enabled only first index.oraccord.enabled([1,3]);// espand first and third index sections.Note : indexstartsfromzero.