- Foundation - Home
- Foundation - Overview
- Foundation - Installation
- Foundation - Starter Projects
- Foundation - Kitchen Sink
- Foundation - Global Styles
- Foundation - Sass
- Foundation - JavaScript
- Foundation - JavaScript Utilities
- Foundation - Media Queries
- Foundation - The Grid
- Foundation - Flex Grid
- Foundation - Forms
- Foundation - Visibility Classes
- Foundation - Base Typography
- Foundation - Typography Helpers
- Foundation - Basic Controls
- Foundation - Navigation
- Foundation - Containers
- Foundation - Media
- Foundation - Plugins
- Foundation SASS
- Foundation - Sass Functions
- Foundation - Sass Mixins
- Foundation Libraries
- Foundation - Motion UI
- Foundation Useful Resources
- Foundation - Quick Guide
- Foundation - Useful Resources
- Foundation - Discussion
Foundation - JavaScript Reference
Foundation provides JavaScript components for an accordion as listed below.
Initializing
You can initialize the accordion in the JavaScript by using the foundation.accordion.js and foundation.core.js plugins. The foundation.core.js plugin requires following libraries −
foundation.util.keyboard.js
foundation.util.motion.js
Foundation.Accordion
It specifies instance of an accordion as defined below −
var my_element = new Foundation.Accordion(element);
The accordion includes one event as specified below −
| S. No. | Name | Type | Description |
|---|---|---|---|
| 1 | element | jQuery | It creates a jQuery object into an accordion. |
Plugin Options
You can use following plugin options to customize the accordion instance.
| S. No. | Name | Description | Example |
|---|---|---|---|
| 1 | slideSpeed | It specifies the time taken to open an accordion. | 200 |
| 2 | multiExpand | It allows to open multiple panes in an accordion. | false |
| 3 | allowAllClosed | It will close all the panes of an accordion. | false |
Events
Accordion plugin provides following events as listed in the table −
| S. No. | Name | Description |
|---|---|---|
| 1 | down.zf.accordion | It triggers an event when you open the tab. |
| 2 | up.zf.accordion | It triggers an event when the tab is collapsing up. |
Events
Accordion plugin provides following functions as listed below −
.toggle
It toggles on and off state of the content pane. It contains below event −
| S. No. | Name | Type | Description |
|---|---|---|---|
| 1 | $target | jQuery | It creates jQuery object for toggling of pane. |
.down
It fires when you open the accordion tab. It includes below events −
| S. No. | Name | Type | Description |
|---|---|---|---|
| 1 | $target | jQuery | It opens the accordion pane. |
| 2 | firstTime | Boolean | It specifies re-execution of the accordion. |
.up
It triggers when the tab is closed. It contains below event −
| S. No. | Name | Type | Description |
|---|---|---|---|
| 1 | $target | jQuery | It closes the accordion tab. |
.destroy
It ruins the instance of an accordion.