Animate Background Color

by kaikemono

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>

JavaScript

var speed = 3000;
$("body").css("background-color","#f00"); // set the base color
function loop(){
    $("body").animate({"background-color": "#ff0"},speed)
        .animate({"background-color": "#0f0" },speed)
        .animate({"background-color": "#0ff" },speed)
        .animate({"background-color": "#00f" },speed)
        .animate({"background-color": "#f0f" },speed)
        .animate({"background-color": "#f00" },speed,loop);
}
loop();