Fiddle here: http://jsfiddle.net/F6nJu/
I have a colored box:
#colorblock { background:#3ff; width: 100%; h
Try this:
var arr = ["#f00", "#ff0", "#f0f", "#f66"];
$.each(arr, function(key, value) {
set_color(value);
});
function set_color(color) {
$('#colorblock').delay('1200').animate({
backgroundColor: color
}, 600);
setTimeout(function() {
set_color(color);
}, 2000); //restart in 2 seconds
}
Fiddle: http://jsfiddle.net/maniator/F6nJu/1/