JSFiddle - React, Tailwind, and code Playground

by LyndseyB

HTML

<body style="background: url('http://oi59.tinypic.com/245wk5h.jpg') no-repeat;" class="js-image-swap">

JavaScript

(function() {
    var imgs = [
            "http://oi57.tinypic.com/245njlt.jpg",
            "http://oi59.tinypic.com/245wk5h.jpg"
        ],
        swap = document.querySelector(".js-image-swap"),
        counter = 0;
    
    setInterval(function() {        
        swap.style.backgroundImage = "url('" + imgs[counter] + "')";
        counter = (counter === imgs.length-1) ? 0 : counter+1;
    }, 10000);   
    
})();