Callbacks (or events) are used to detect when certain actions take place. The callbacks can be added when the accordion is instantiated, or at a later time.
Examples:
$('#my-accordion').accordionSlider({ width: 1200, height: 400, responsiveMode: 'custom', panelOpenComplete: function(event) { console.log(event.index); }, panelsCloseComplete: function(event) { console.log(event.previousIndex); } }); $('#my-accordion').on('panelOpen', function(event) { console.log(event.index); })
As you can notice, the callback functions have an "event" parameter which contains some information about that event.
The list of available events:
init
Triggered after the accordion was created.
update
Triggered when the 'update' method is called, either automatically or manually.
accordionMouseOver
Triggered when the mouse pointer moves over the accordion.
accordionMouseOut
Triggered when the mouse pointer leaves the accordion.
panelClick
Triggered when a panel is clicked. Returned data:
- index: the index of the clicked panel
panelMouseOver
Triggered when the mouse pointer moves over a panel. Returned data:
- index: the index of the panel over which the mouse pointer has moved
panelMouseOut
Triggered when the mouse pointer leaves a panel. Returned data:
- index: the index of panel from which the mouse pointer has moved away
panelOpen
Triggered when a panel is opened. Returned data:
- index: the index of the opened panel
- previousIndex: the index of the previously opened panel
panelsClose
Triggered when the panels are closed. Returned data:
- previousIndex: the index of the previously opened panel
pageScroll
Triggered when the accordion scrolls to another page. Returned data:
- index: the index of the current page
panelOpenComplete
Triggered when the opening of a panel is completed. Returned data:
- index: the index of the opened panel
panelsCloseComplete
Triggered when the closing of the panels is completed. Returned data:
- previousIndex: the index of the previously opened panel
pageScrollComplete
Triggered when the scroll to a page is completed. Returned data:
- index: the index of the current page
breakpointReach
Triggered when a breakpoint is reached. Returned data:
- size: the specified size that was reached
- settings: the settings specified for the current size
videoPlay
Triggered when a video starts playing.
videoPause
Triggered when a video is paused.
videoEnd
Triggered when a video ends.
0 Comments