JSFiddle - React, Tailwind, and code Playground

HTML

<img src="http://idontexist1.com/willtaketimetoload"/>
<img src="http://idontexist2.com/willtaketimetoload"/>
<img src="http://idontexist3.com/willtaketimetoload"/>
<div id="foo"></div>

CSS

#foo{ background: red; height:100px;}

JavaScript

function id(id) { return document.getElementById(id); }

window.setBlue = function() {
    id('foo').style.background = 'blue';
};
window.sethGreen = function() { 
    id('foo').style.background = 'green';
};

$(function() {
    setBlue();
});

$(window).load(function() {
    sethGreen();
});

document.onreadystatechange = function() {
    if (document.readyState == "interactive")   setBlue();    
}