JSFiddle - React, Tailwind, and code Playground

by Ben Watts

HTML

<h1 id="header">Welcome to News Champ</h1>
<h2>Talk about the league</h2>
<h3>If you are going for the win, make sure you drink to win</h3>

JavaScript

function fadeOut(element, hide) {
    var opacity = 1;
    var fader = setInterval(function () {
        if (opacity <= 0.01){
            clearInterval(fader);
            element.style.opacity = 0;
            if(hide)
            {
                element.style.display = 'none';
            }     
        }
        element.style.opacity = opacity;
        element.style.filter = 'alpha(opacity=' + opacity * 100 + ")";
        opacity -= opacity * 0.1;
    }, 50);
}

fadeOut(document.getElementById("header"), true);