#jQuery Accordion
An "accordion" is UI widget that helps manage content on a web page by keeping it hidden until needed. The ideal content for an accordion will be a information divided into "headings" and "bodies". The headings are always shown but the bodies are hidden until the user selects the heading.
Our accordion widget consists of an alternating h3
and div
elements, where the h3
is used as a heading and the div
is used as a body. By default, all div
elements are collapsed. When the user clicks on a h3
element, the div
that immediately follows it will be expanded, while any other expanded div
element will be collapsed.
We will use the .slideUp()
and .slideDown()
jQuery methods to create a smooth effect when the div
elements are expanded and collapsed.
MIT