The code is not perfect: var imgArray = [ "img1" , "img2", "img3"];
function swap(i){ if(imgArray.length > i){ $('.' + imgArray[i]).removeClass(imgArray[i]).addClass(imgArray[i+1]); }else{ return; } setTimeout("swap("+(i+1)+")", 5000); } // Call the function swap(0); ---- Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Fri, Mar 20, 2009 at 5:15 PM, Alexandru Dinulescu <alex.d.a...@gmail.com> wrote: > Hello. > > I have a huge question. I need something that rotates classes each 5 seconds > for ex > > I have a <div class="img1"> </div>. I want each 5 seconds the class to be > changed from img1 to img2, and so on so at the start an array should be > placed like > imgArray = [ "img1" , "img2", "img3", etc ] > > I need css classes changed not a plain image since the image is a > background image and i have text on it. > > I did look over google but i couldnt find any help regarding this matter. > > Thank you > > ------------------- > Alexandru Dinulescu > Web Developer > (X)HTML/CSS Specialist > Expert Guarantee Certified Developer > XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053 > CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619 > RentACoder Profile: > http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323 > > MainWebsite: http://alexd.adore.ro > >