JSFiddle - React, Tailwind, and code Playground

by LyndseyB

CSS

body { background-image: url('http://i413.photobucket.com/albums/pp211/georgiojc/Sports/FILE0053_zps358b9165.jpg') }

JavaScript

$(function() {        
    var i = 0;
    //define array of images to use
    var imgArray = ["http://i413.photobucket.com/albums/pp211/georgiojc/Sports/FILE0053_zps358b9165.jpg", "http://i876.photobucket.com/albums/ab324/Mollinski/Hollywood%20Celebrities%20AUTO/scan0285.jpg", "http://i413.photobucket.com/albums/pp211/georgiojc/Sports/FILE0041_zps29c35c73.jpg"];
      
    setInterval(loopImg, 4000);    
    function loopImg() {    
        i++;
        if(i==imgArray.length) { i=0; }
        $('body').css('background-image', 'url('+ imgArray[i] +')');
    }  
  
});