$(document).ready(function () {
function runPics(){
$('#imgone').delay(500).fadeIn(1000,function(){
$('#imgtwo').fadeIn(1000,function(){
$('#imgthree').fadeIn(1000,function(){
$('#imgone').fadeOut(500,function(){
$('#imgtwo').fadeOut(500,function(){
$('#imgthree').fadeOut(500,function(){
runPics();
})
})
})
})
})
})
};
runPics();
});
. , , , .
The loop just starts the function from the inside, after all the others have ended.
This code has not been verified.
Edit: In response to the comment, I updated the code ...
$(document).ready(function () {
function runPics(){
$('#imgone').delay(500).fadeIn(1000,function(){
$('#imgtwo').fadeIn(1000,function(){
$('#imgthree').fadeIn(1000,function(){
$('#imgone').fadeOut(500)
$('#imgtwo').fadeOut(500)
$('#imgthree').fadeOut(500,function(){
$('#imgone').attr({src:'alreadyCachedImage.jpg'})
runPics();
})
})
})
})
};
runPics();
});
source
share