responsive

isPaused()

  • Available since: v1.2
  • Type: public method
  • Returns: Boolean (true or false)

Method returns boolean value which specifies whether autoplay is paused.

Method calling

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();

Demo 1

  • HTML
  • JS
<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.

Loading content...
slide1
slide2
slide3
slide4
slide5

Demo 2

  • HTML
  • JS
<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.

Loading content...
slide1
slide2
slide3
slide4
slide5

jAccordion by maniacpc, exclusively for CodeCanyon