JSFiddle - React, Tailwind, and code Playground

by cssGuy

HTML

<div id="a"></div>
<div id="b"></div>

CSS

#a,#b {
    width: 50px;
    height: 50px;
}

JavaScript

function fade(id) {
    var dom = document.getElementById(id),
        level = 1;

    function step() {
        var h = level.toString(16);
        dom.style.backgroundColor = '#FFFF' + h + h;
        if (level < 15) {
            level += 1;
            setTimeout(step, 100)
        }
    }
    setTimeout(step, 100);
}
fade('a');
fade('b');