responsive

Added/updated in: All versionsVersion 1.0Version 1.1Version 1.2Version 1.2.1

Public API

Public API lets user control and modify behaviour of the plugin after its initialization.

Methods and variables can be accessed inside every callback function:

this.method();	//For methods
this.variable; 	//For variables

In case there is only one element matching the selector, methods and variables can be accessed anywhere in your code:

$('selector').data('jAccordion').method();	//For methods
$('selector').data('jAccordion').variable; 	//For variables

In case there are more elements matching the selector, variable can be accessed anywhere in your code (eq(index) specifies index of accordion instace):

$('selector').eq(index).data('jAccordion').method();	//For methods
$('selector').eq(index).data('jAccordion').variable; 	//For variables
Method/Variable
Description
$accordion

Public variable which stores jQuery object of the accordion.

 
getVersion()

Returns version of the jAccordion plugin.

 
goToSlide(slideIndex)

Method opens a slide with specified index - slideIndex (if not out of bounds). Slides are numbered from 0, which means that 1st slide = 0, 2nd slide = 1 etc. This method internally uses jQuery method eq, which means that you can use all of the advantages of this method such as goToSlide(-1) to open the last slide.

 
goToFirstSlide()

Method opens the first slide. This method has the same effect as goToSlide(0).

 
goToLastSlide()

Method opens the last slide. This method has the same effect as goToSlide(-1).

 
closeSlides()

Method closes all slides (i.e. sets the same size for all the slides). Method takes effect only if one of the slide is open and autoplay is disabled.

 
isAnimated()

Method returns boolean value which determines whether a slide is opening or closing.

 
getSlidesCount()

Method returns number of slides.

 
getActiveSlide()

Method returns active slide (if there is one) as jQuery object or null.

 
getActiveSlideIndex()

Method returns index of active slide or -1 if none is selected. Slides are numbered from 0, which means that 1st slide = 0, 2nd slide = 1 etc.

 
isPaused()

Method returns boolean value which specifies whether autoplay is paused.

 

Callbacks

In the callback function, this always means instance of the accordion, which means that you can access any public variable or call any public API method using:

this.method();	//For methods
this.variable; 	//For variables
Callback
Description
ready()

Callback function to be executed after the accordion is fully loaded.

Callback execution
  • preloadImages enabled - callback function is executed after every image of every slide is loaded (Note: background images are not taken into consideration).
  • preloadImages disabled - callback function is executed after the plugin is loaded.
 
onSlideOpened(e)

Callback function to be executed after a slide is completely open.

Event properties:
  • $slide - jQuery object of the open slide
  • index - index of the open slide
 
New in 1.0Changed in 1.2More info & demo
onSlideStartOpening(e)

Callback function to be executed when a slide starts opening.

Event properties:
  • $slide - jQuery object of the opening slide
  • index - index of the opening slide
 
New in 1.0Changed in 1.2More info & demo
onSlideStartClosing(e)

Callback function to be executed when a slide starts closing.

Event properties:
  • $slide - jQuery object of the closing slide
  • index - index of the closing slide
 
New in 1.0Changed in 1.2More info & demo
onAccordionMouseEnter()

Callback function to be executed when cursor enters the accordion's direct children .jAccordion-slidesWrapper.

 
onAccordionMouseLeave()

Callback function to be executed when cursor leaves the accordion's direct children .jAccordion-slidesWrapper.

 
onPause()

Callback function to be executed when autoplay is paused, i.e. when cursor enters accordion's direct children .jAccordion-slidesWrapper.

 
onResume(e)

Callback function to be executed 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
 

Options

Options are used to affect behaviour of jAccordion. Options may depend on others in which case it's mentioned in the description page of the option. Options are placed in configuraiton section of jAccordion and are separated by comma.

Example of configuration section of jAccordion:

$('.accordion').jAccordion({
	activeSlideSize : 750,
	spacing : 3,
	sticky : true,
	autoplay : true,
	autoplayInterval : 5000,
	arrowKeysNav : true,
	nextBtn : $('.nextBtn'),
	prevBtn : $('.prevBtn')
});
Option
Type and default value
Description
accordionAutoSize
Booleanbulletfalse

Specifies whether size (width/height) of accordion is automatically adjusted to fit size of content but max size (set via CSS) can't be exceeded.

 
activeSlideAutoHeight
Booleanbulletfalse

Specifies whether height of active slide should be determined by its content.

 
activeSlideClass
Stringbullet'active_slide'

Class which is added to active slide.

 
New in 1.0 as activatedSlideIDChanged in 1.2More info & demos
activeSlideSize
Positive integerbullet650

Size (width/height, depends on vertical) of active slide.

 
New in 1.0 as slideMaxWidthChanged in 1.2More info & demos
arrowKeysNav
Booleanbulletfalse

Enables/disables using of arrow keys to control the active accordion. Accordion can be activated by clicking it (if option event is 'click') or by moving cursor over a slide (if option event is 'mouseenter') so only one instance can be controlled at the moment. Left and top keys are used to activate the previous slide and the right and bottom ones are used to activate the next slide.

 
autoplay
Booleanbulletfalse

Enables/disables auto rotation of slides.

 
autoplayInterval
Positive integerbullet3000

Amount of time for which a slide is displayed if using autoplay.

 
New in 1.0 as autoplayDelayChanged in 1.2More info & demos
defaultActiveSlideIdx
Integerbulletnull

Index of slide which is open by default. All slides are closed if no value is set. Slides are numbered from 0. First slide equals 0, second slide equals 1, etc. Plugin internally uses jQuery method eq so you can set -1 to select the last slide.

 
New in 1.0 as activeSlideChanged in 1.2More info & demos
disableBtnsDuringTransition
Booleanbullettrue

Specifies whether prevBtn and nextBtn are temporarily disabled while any slide is opening/closing.

 
easing
Stringbullet'swing'

Easing function used for animation of slides. jQuery library offers only two functions - 'swing' and 'linear' but you can use jQuery easing plugin to extend list of the functions. This plugin is included in all provided demos.

 
New in 1.0 as slidesEasingChanged in 1.2More info & demos
event
Stringbullet'mouseenter'

Mouse event used to trigger slide opening. Allowed values are 'click' and 'mouseenter'. Value 'click' is automatically used for handheld devices.

 
headers
Selectorbulletnull

HTML element which is included in every slide (exactly one header per one slide). Clicking the header causes the slide to open/close.

 
inactiveSlideSize
Positive integerbullet0

Size (width/height) of inactive slide. If set then option activeSlideSize is not used (even if set).

 
keepAspectRatio
Booleanbullettrue

Specifies whether to change height in the same proportion as width when width of the accordion is changed.

 
nextBtn
jQuery objectbulletnull

Clicking the element(s) causes opening of the next slide or the first one if none is active.

 
pauseOnHover
Booleanbullettrue

autoplay is paused when cursor enters accordion's direct children .jAccordion-slidesWrapper.

 
preloadImages
Booleanbullettrue

Specifies whether slides remain hidden until all of the images are fully loaded.

 
New in 1.0 as usePreloaderChanged in 1.2More info & demos
preloadTransitionSpeed
Integerbullet500

Duration (in milliseconds) of fade-in transition of accordion after all of the images are fully loaded.

 
New in 1.0 as preloadFadeInDurationChanged in 1.2More info & demos
prevBtn
jQuery objectbulletnull

Clicking the element(s) causes opening of the previous slide or the last one if none is active.

 
responsive
Booleanbullettrue

Specifies whether to change accordion dimensions according to its parent.

 
scaleImgs
Stringbullet'fit'

Specifies which method of scaling is applied to images with class jAccordion-img.

Methods of scaling
  • fitWidth - width of images is adjusted so it's same as width of a slide and height is changed in the same proportion
  • fitHeight - height of images is adjsuted so it's same as height of a slide and width is changed in the same proportion
  • fit - size of images is adjusted to completely fill the whole slide
 
New in 1.2.1More info & demos
spacing
Integerbullet0

Space (in pixels) between each slide.

 
sticky
Booleanbulletfalse

Active slide remains open until another one is selected.

 
transitionSpeed
Integerbullet500

Duration (in milliseconds) of transition (opening/closing a slide).

 
New in 1.0 as slideDurationChanged in 1.2More info & demos
vertical
Booleanbulletfalse

Specifies whether slides are stacked vertically or horizontally.

 

jAccordion by maniacpc, exclusively for CodeCanyon