JSFiddle - React, Tailwind, and code Playground

HTML

<img src="http://www.petscarecenter.com/wp-content/uploads/2011/05/dog.jpg" id="background" />
<img src="http://cvcl.mit.edu/hybrid/cat2.jpg" id="background_hidden" />

<button id="fade_out">fade to new image</button>

CSS

#background {
    width: 100%;
    height: 100%;
    z-index: -1;
    position: absolute;
}

#background_hidden {
    width: 100%;
    height: 100%;
    display: none;
    position: absolute;
    z-index: -1;
}

JavaScript

window.onload = function() {
    var button = document.getElementById("fade_out").onclick = changeBackground;
}
    
function changeBackground() {
var background = document.getElementById("background");
var h_background = document.getElementById("background_hidden")

$('#background').fadeOut('slow', function() {$('#background_hidden').fadeIn('slow')});
}