I'm trying to implement a jQuery function with an infinite loop to animate the body background with 3 colours. I cannot think of a nice and clean solution. Something like this?
$(document).ready(function(){
$('body').animate({backgroundColor:'#ffcc00'}, 500, function(){
$('body').animate({backgroundColor:'#eeeeee'}, 500, function(){
$('body').animate({backgroundColor:'#3b5998'}, 500);
});
});
});
Any idea?
$(document).ready(function(){
function animate() {
$('body').animate({backgroundColor:'#ffcc00'}, 500, function(){
$('body').animate({backgroundColor:'#eeeeee'}, 500, function(){
$('body').animate({backgroundColor:'#3b5998'}, 500, function(){
animate();
});
});
});
}
animate();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With