So I have a custom transition which animates various elements at a time. When the user clicks the next slide button quickly (before the animation is finished) it causes all sorts of problems. How do I solve this? I tried a nooby idea of adding/removing the active class on the links but that didn't work.
Here is a jfiddle to show the problem: http://jsfiddle.net/SHRA6/12/
Here is my js:
$.fn.cycle.transitions.slideCustom = function($cont, $slides, opts) {
$caption = $('.serverbig')
$feature = $('.featurehol')
$heading = $('h2')
opts.fxFn = function(curr,next,opts,cb,fwd) {
$feature.animate({ top: '350px' }, 500, opts.easing);
$heading.animate({ left: '-550px' }, 500, opts.easing);
$caption.animate({ right: '-550px' }, 500, opts.easing, function() {
$(curr).animate({ opacity: 0 }, 500, opts.easing, function() {
});
$(next).css({ display: 'block'}).animate({ opacity: 1 }, 500, opts.easing);
$feature.animate({ top: '66px' }, 500, opts.easing);
$heading.animate({ left: '0' }, 500, opts.easing);
$caption.animate({ right: '0px' }, 500, opts.easing, function() {
if(cb) cb();
});
});
}
}
$('#sliderb').cycle({
fx: 'slideCustom',
speed: 'slow',
timeout: 0,
next: '.nextslide',
prev: '.prevslide',
easing: 'easeInOutBack',
slideExpr: '.slide',
});
An additional problem causes the background (main slide) to flash in, instead of fading in using the opacity animation.