responsive

getActiveSlide()

  • Available since: 1.2
  • Type: public method
  • Return value: jQuery object of the active slide

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

Method calling

1) Method can be called inside every callback function (as demonstrated in demo 1):

this.getActiveSlide();

2) In case there is only one element matching the selector, method can be called anywhere in your code (as demonstrated in demo 2):

$('selector').data('jAccordion').getActiveSlide();

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

$('selector').eq(index).data('jAccordion').getActiveSlide();

Demo 1

  • Source files of this demo are located in: Examples\APIgetActiveSlideDemo1

Demo 1 demonstrates how to call the described method inside callback function onSlideOpened() (the protocol is the same for all callback functions). jQuery object (active slide) returned by the described method is used to change border of active slide. The method is called when onSlideOpened() is triggered.

Note: You can gain direct access to active slide in callbacks onSlideOpened(), onSlideStartOpening() and onSlideStartClosing() as you can read in section called "Event properties" in description of these callbacks. There is no need to call the described method in the mentioned callbacks, the demonstration was created just to prove that it's possible.

Loading content...
slide1
slide2
slide3
slide4
slide5

Demo 2

  • Source files of this demo are located in: Examples\APIgetActiveSlideDemo2

Demo 2 demonstrates how to call the described method anywhere in your code. Open a slide by moving cursor over it and then click button below accordion to change border style of active slide and then click it again to set it back to default border style.

Loading content...
slide1
slide2
slide3
slide4
slide5

jAccordion by maniacpc, exclusively for CodeCanyon