I’m using the jQuery Cycle plugin for a slider – I need to make some fadeIn fadeOut effect inside each slides.
Has any one had any experience with this? Unfortunately I am quite
useless at JavaScript creation, and I have not been able to find any great support documentation.
Here is a example
And my function code is below.
$('#yslider ul').cycle({
fx: 'fade',
speed: 'slow',
timeout: 1000,
before: first,
after: second,
pager: '#number',
pause: 1
});
function first(){
$('.left').fadeOut(800).delay(100).animate({opactiy: 0.5 });
$('.middle').delay(800).fadeOut(1300).animate({opactiy: 1.0 });
$('.right').delay(2500).animate({right:'-1980px'}, 700);
}
function second(){
$('.left').fadeIn(1000).delay(300).animate({opactiy: 1.5 });
$('.middle').fadeIn(1500).delay(500).animate({opactiy: 2.5 });
$('.right').delay(2500).animate({right: '-26px'}, 700);
}
all you need is call before: option of cycle.. onBefore initialize your animations and put some delay and then finalize your animation.
i put eq() to perform only current ‘li’ because you are using same class for all sliding tabs.
also you’ll need to edit some of your css
set timeout as per your overall animation duration + delay in each slide
here i set 10000 ms = starting animation (800 + 1300 + 700) + delay(4400) + final animation(900+1300+800)