jquery fade in, fade out loop
Hcx’s Question:
I want to create a loop like this,
anim = function () {
$('.a1').fadeOut(function () {
$('.b1').fadeIn(function () {
$('.b1').delay(5000).fadeOut(function () {
$('.a1').fadeIn(function () {
setTimeout(anim, 2000);
});
});
});
});
};
setTimeout(anim, 2000);
but after one loop .b1 is not fade in again so what could be the problem? or is there a better way to do this?
setTimeout()
executes the function once, you are looking for setInterval()