jQuery Cycle: Update currSlide onClick -
jQuery Cycle: Update currSlide onClick -
i'm using jquery cycle plugin create image slideshow. works great, have minor issue can't seem solve. if click on "prev" or "next" links slideshow counter doesn't update until after animation has finished. ideally slideshow count update clicked on either of these links, , animation take place.
jsfiddle here: http://jsfiddle.net/dd52s/
instead of after callback utilize before callback if want counter set before animation begins. seek this
$(document).ready(function() { $('.slideshow').cycle({ fx: 'scrollhorz', timeout: 0, next: '.next, .slideshow img', prev: '.prev', speed: 600, before: onafter, }); function onafter(curr,next,opts) { var caption = ($(next).index() + 1) + '/' + opts.slidecount; $('.counter').html(caption); } $('.description').cycle({ fx: 'none', timeout: 0, next: '.next, .slideshow img', prev: '.prev' }); }); working http://jsfiddle.net/dd52s/2/
jquery jquery-cycle
Comments
Post a Comment