animation in cascade not working properly
Hello guys,
Im making a simple animation with slides fading in and fading out, i did it very simply coding it like this:
-
$(document).ready(function(){
$('.intros').each(function (i){
$('#slide'+i).fadeIn(tiempo,function(){
$(this).fadeOut(tiempo);
});
});
});
But it didnt work properly, it didnt do it as expected, which is the second slide should slide in when the first already faded out, like it did when I first did it:
-
var tiempo=2000;
$(document).ready(function(){
$('#primero').fadeIn(tiempo,function(){
$(this).fadeOut(tiempo,function(){
$('#segundo').fadeIn(tiempo,function(){
$(this).fadeOut(tiempo,function(){
$('#tercero').fadeIn(tiempo,function(){
$(this).fadeOut(tiempo,function(){
$('#cuarto').fadeIn(tiempo,function(){
$(this).fadeOut(tiempo,function(){
$('#quinto').fadeIn(tiempo,function(){
$(this).fadeOut(tiempo,function(){
$('#sexto').fadeIn(tiempo,function(){
$(this).fadeOut(tiempo,function(){
saltar();
});
});
});
});
});
});
});
});
});
});
});
});
});
Obviously its mucho code. Could you lend me a hand and show me another way of making it more simple?
Thanks!