Reputation: 653
I'm working with a preexisting jQuery script that uses .FadeOut when rotating divs. The problem with this is that the div fades out but the next div that rotates in sort of snaps into place instead of fading in. I'm trying to figure out an easy way to add a .fadeIn() without rebuilding the function from scratch, but my JS skills are failing me. Is there a simple way to adjust this script that I am missing or should I just rebuild it?
function rotate() {
$('div.divRT').each(function (index, value) {
var nextDv = $(this).find('div.stDv:visible').next('div.stDv');
if (nextDv.html() == null) {
nextDv = $(this).find('div.styDv:first-child');
}
$(this).find('div.stDv:visible').fadeOut(400, function () { nextDv.show(); });
});
timer = setTimeout(rotate, 4000);
}
The part in question is:
$(this).find('div.stDv:visible').fadeOut(400, function () { nextDv.show(); });
Is there a way to insert .fadein(400) somewhere so that when nextDV is shown it will fade in?
Any advice appreciated.
Thanks!
Upvotes: 0
Views: 112