jquery run function in infinite loop
Posted
by zac
on Stack Overflow
See other posts from Stack Overflow
or by zac
Published on 2010-05-30T04:33:57Z
Indexed on
2010/05/30
4:42 UTC
Read the original article
Hit count: 244
I am creating a background color animation with jQuery and the color animation plugin http://plugins.jquery.com/project/color
How do I have a function stay in a loop repeating itself each time it has finished running? I tried this but it did not work :
$(document).ready(function(){
function colorLoop(){
$("#window")
.animate({ backgroundColor: "orange" }, 11000)
.animate({ backgroundColor: "yellow" }, 1000)
.animate({ backgroundColor: "green" }, 1000)
.animate({ backgroundColor: "blue" }, 1000)
.animate({ backgroundColor: "indigo" }, 1000)
.animate({ backgroundColor: "violet" }, 1000)
.animate({ backgroundColor: "red" }, 1000, colorLoop);
};
});
© Stack Overflow or respective owner