/ Published in: JavaScript
all pagers with class of .slideshow
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>