JSFiddle - React, Tailwind, and code Playground
by RomanFF
HTML
<div></div>
CSS
div{
background-color: red;
width: 100px;
height: 100px;
}
function fadeOut(el) {
var opacity = 1;
var timer = setInterval(function() {
if(opacity <= 0.1) {
clearInterval(timer);
document.querySelector(el).style.display = "none";
}
document.querySelector(el).style.opacity = opacity;
opacity -= opacity * 0.1;
}, 10);
}