Method returns boolean value which specifies whether autoplay is paused.
1) Method can be called inside every callback (as demonstrated in demo 1):
this.isPaused();
2) In case there is only one HTML element matching the selector, method can be called anywhere in your code (as demonstrated in demo 2):
$('selector').data('jAccordion').isPaused();
3) In case there are more HTML elements matching the selector, method can be called anywhere in your code (eq(index) specifies index of accordion instance):
$('selector').eq(index).data('jAccordion').isPaused();
<div class="accordion noJS"> <div class="preloader">Loading content...</div> <div class="jAccordion-slidesWrapper"> <div class="jAccordion-slide"><img src="images/banner1.png" width="910" height="380" alt="slide1" /></div> <div class="jAccordion-slide"><img src="images/banner2.png" width="910" height="380" alt="slide2" /></div> <div class="jAccordion-slide"><img src="images/banner5.png" width="910" height="380" alt="slide3" /></div> <div class="jAccordion-slide"><img src="images/banner3.png" width="910" height="380" alt="slide4" /></div> <div class="jAccordion-slide"><img src="images/banner4.png" width="910" height="380" alt="slide5" /></div> </div> </div>
jQuery(document).ready(function( $ ) { $('.accordion').jAccordion({ autoplay : true, sticky : true, onReady : function() { $('.preloader', this.$accordion).remove(); }, onPause : function(e) { alert('Autoplay is ' + (this.isPaused() ? "paused" : "not paused") + '.'); }, onResume : function(e) { alert('Autoplay is ' + (this.isPaused() ? "paused" : "not paused") + '.'); } }); });
Demo 1 demonstrates how to call the described method inside callback attached to event onPause and onResume (the protocol is the same for all callbacks). Move cursor over accordion and look at the report below which indicates whether accordion is paused.
<div class="accordion noJS"> <div class="preloader">Loading content...</div> <div class="jAccordion-slidesWrapper"> <div class="jAccordion-slide"><img src="images/banner1.png" width="910" height="380" alt="slide1" /></div> <div class="jAccordion-slide"><img src="images/banner2.png" width="910" height="380" alt="slide2" /></div> <div class="jAccordion-slide"><img src="images/banner5.png" width="910" height="380" alt="slide3" /></div> <div class="jAccordion-slide"><img src="images/banner3.png" width="910" height="380" alt="slide4" /></div> <div class="jAccordion-slide"><img src="images/banner4.png" width="910" height="380" alt="slide5" /></div> </div> </div>
jQuery(document).ready(function( $ ) { $('.accordion').jAccordion({ autoplay : true, sticky : true, onReady : function() { $('.preloader', this.$accordion).remove(); window.setInterval(checkAutoplayState, 1000); } }); function checkAutoplayState() { alert('Autoplay is ' + ($(".accordion").data("jAccordion").isPaused() ? "paused" : "not paused")); } });
Demo 2 demonstrates how to call the described method anywhere in your code. Method is called every second.
jAccordion by maniacpc, exclusively for CodeCanyon