I have a single div, where i need to change between 4 different colors on repeat. So every, say 5 second, it faded to the next color “in line”, and when all 4 colors have been shown, it starts over again.
How would i do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use an array of colors, the modulo operator, and the setTimeout method in conjunction with the color animations available as part of JQuery UI:
Sample fiddle: http://jsfiddle.net/johnkoer/8GGFM/26/