Im very new to jQuery and I already had a hard time doing just this. I have several Div's with the class ".figures" which are set to "display: none;" I would like to have the same effect like now, but without showing the same div twice or more in a row. I have to store the number somehow, so I can check wether it's the same as before, right? How can I do this?
Here's the code:
(function randomFade() {
var fadeDivs = $('.figures'),
el = fadeDivs.eq(Math.floor(Math.random() * fadeDivs.length));
el.fadeIn('1000').delay(2000).fadeOut('1000',randomFade);
})();
Aucun commentaire:
Enregistrer un commentaire