I have this function that returns a random color, but I want to apply it to jQuery .animate() function.
How can I do that?
var colors = ["rgb(120,25,25)", "rgb(50,100,130)", "rgb(30,95,45)", "rgb(55,30,90)"];
function randomBackground() {
return colors[Math.floor(Math.random() * messages.length)];
}
$("#menu").animate({background: randomBackground()});
You could do: