Return to Snippet

Revision: 52138
at October 14, 2011 03:37 by kbrown


Updated Code
<script type="text/javascript">

var clickedBtn = 'no';

$(document).ready(function() {
	$('.slideshow').each(function(index) {
		$(this).cycle({
		fx:     'fade',
		timeout: 4000,
		speed:   2000,
		sync:    true,
		pager:  '#slideBtns',
		after: onAfter,
		pagerAnchorBuilder: function(i) {
			if (index == 0)
			// for first slideshow, return a new anchor
			return '<a href="#" onclick="pagerClick();">'+(i+1)+'</a>';
			// for 2nd slideshow, select the anchor created previously
			return '#slideBtns a:eq('+i+')';
			}
		});
	});
});


function pagerClick() { 
	clickedBtn = 'yes';
}	

function onAfter() { 
	if (clickedBtn == 'yes') {
		$('.slideshow').cycle('pause');	
	}
}

</script>

Revision: 52137
at October 14, 2011 03:33 by kbrown


Initial Code
<script type="text/javascript">

var clickedBtn = 'no';
			
$(document).ready(function() {
    $('.slideshow').each(function(index) {
        $(this).cycle({
			fx:     'fade',
			timeout: 4000,
			speed:   2000,
			sync:    true,
			pager:  '#slideBtns',
			after: onAfter,
			pagerAnchorBuilder: function(i) {
				if (index == 0)
					// for first slideshow, return a new anchro
					return '<a href="#" onclick="pagerClick();">'+(i+1)+'</a>';
				// for 2nd slideshow, select the anchor created previously
				return '#slideBtns a:eq('+i+')';
        	}
		});
    });
});


function pagerClick() { 
	clickedBtn = 'yes';
}	
	
function onAfter() { 
	if (clickedBtn == 'yes') {
		$('.slideshow').cycle('pause');	
	}
}

</script>

Initial URL

                                

Initial Description
all pagers with class of .slideshow

Initial Title
Jquery - 2 cycles 1 pager (stop on click)

Initial Tags

                                

Initial Language
JavaScript