responsive

Added/updated in: All versionsVersion 1.2.6Version 1.2Version 1.0

Events

jAccordion offers numerous events to which you can attach custom functions (callbacks) to add even more features. Almost every callback contain special event object as an function parameter which extends the original event. Below you can find a summary of all available events with possibility to display detailed explanation and demo(s).

Attaching callbacks

There are multiple ways how to attach callbacks to events.

1) Callbacks can be attached to events in configuration section of jAccordion:

<script type="text/javascript">
	// Avoid conflict with other libraries
	jQuery(document).ready(function( $ ) {
		$('.accordion').jAccordion({
			// Callback attached to event onReady
			onReady : function() {
				// some code
			},
			// Callback attached to event onSlideOpened
			onSlideOpened : function(e) {
				// some code
			}
		});
	});
</script>

2) Callbacks can be attached to events after initialization using API methods bind() and on():

<script type="text/javascript">
	// Avoid conflict with other libraries
	jQuery(document).ready(function( $ ) {
		$('.accordion').jAccordion();
		// Attach callback to event onAccordionMouseEnter
		$('.accordion').data('jAccordion').bind('onAccordionMouseEnter', function () {
			// some code
		});
	});
</script>

Removing callbacks

There is of course possibility to remove callbacks (it doesn't matter which of the two previous methods was used to attach them) using API methods unbind() and off():

<script type="text/javascript">
	// Avoid conflict with other libraries
	jQuery(document).ready(function( $ ) {
		$('.accordion').jAccordion({
			onAccordionMouseEnter : function () {
				// some code
			}
		});
		// Remove callback attached to event onAccordionMouseEnter
		$('.accordion').data('jAccordion').unbind('onAccordionMouseEnter');
	});
</script>
Event
Description
onReady

Triggers after the accordion has been fully loaded.

Callback execution
  • if option preloadImages enabled - executes when all images inside slides are loaded (Note: background images are not taken into consideration).
  • if option preloadImages disabled - executes when accordion is initialized.
 
New in v1.2Changed in v1.2.6More info & demo
onSlideOpened

Triggers when a slide is completely open.

Event properties:
  • $slide - jQuery object of the open slide
  • index - index of the open slide
 
New in v1.0Changed in v1.2More info & demo
onSlideStartOpening

Triggers when a slide starts opening.

Event properties:
  • $slide - jQuery object of the opening slide
  • index - index of the opening slide
 
New in v1.0Changed in v1.2More info & demo
onSlideStartClosing

Triggers when a slide starts closing.

Event properties:
  • $slide - jQuery object of the closing slide
  • index - index of the closing slide
 
New in v1.0Changed in v1.2More info & demo
onAccordionMouseEnter

Triggers when cursor enters the accordion's direct children .jAccordion-slidesWrapper.

 
New in v1.2More info & demo
onAccordionMouseLeave

Triggers when cursor leaves the accordion's direct children .jAccordion-slidesWrapper.

 
New in v1.2More info & demo
onPause

Triggers when autoplay is paused, i.e. when cursor enters accordion's direct children .jAccordion-slidesWrapper.

 
New in v1.2More info & demo
onResume

Triggers when autoplay is resumed, i.e. when cursor leaves accordion's direct children .jAccordion-slidesWrapper.

Event properties:
  • remainingTime - remaining time (in milliseconds) for which the active slide remains open
 
New in v1.2More info & demo

jAccordion by maniacpc, exclusively for CodeCanyon