views:

78

answers:

1

Sometimes, the slideshow on my website, which uses fadeOut and fadeIn to cycle through three main images will fadeIn a new photo without fading the old one. This doesn't happen every time the page loads though. My site is here (the slideshow will take 7 seconds to change): http://codersarepeople.com/v2/

The code I use is this

slideshow = new Array('#slideshow1','#slideshow2','#slideshow3');
var i = Math.floor(Math.random()*3);
$(slideshow[i]).fadeIn(125);
var t = setInterval(function() {
 $(slideshow[i%3]).fadeOut(250,function() {
  $(slideshow[(i+1)%3]).fadeIn(250);
 });
 i++;
},7000);
+1  A: 

It turns out, the error only occurs when the random variable i = 0. I just cheated and forced it to either equal 1 or 2. I still don't know why that was happening though.

codersarepeople