Answers for "change the background of an element in a loop using css"

CSS
0

change the background of an element in a loop using css

var colors = ['blue', 'green', 'yellow', 'black'],
        colorIndex = 0,
        $body = $('body');
    
    setInterval(function(){ $body.css('background', colors[colorIndex++ % colors.length])}, 1000);
Posted by: Guest on June-25-2021

Code answers related to "change the background of an element in a loop using css"

Browse Popular Code Answers by Language