I have several images that I'd like to fade in and out randomly and
independently from each other. This is the code I have so far, but the
only thing that happens is the last image blinking three times.

I'm guessing that I shouldn't use the same variable (t) for every
animation but I don't really know how I would do this.

Anyone care to help?

This is the code:

$('.main_nav img').each(function() {
                $(this).css("opacity", 0);
                animatedLink = this;
                t=setTimeout("timedAnim(animatedLink)",getRandom());
});

function getRandom() {
        return (Math.random()*1000);
}

function timedAnim(obj) {
if(($(obj).css("opacity")) == 0){
$(obj).css("opacity", 1);
}
else{
$(obj).css("opacity", 0);
}
}

Reply via email to