JSFiddle - React, Tailwind, and code Playground
HTML
<div id="fee">FEE</div>
<div id="foo">FOO</div>
<div id="bar">BAR</div>
CSS
.flash {
animation-name: redflash;
animation-duration: 5s;
}
@keyframes redflash {
from {
background-color: #FF0000;
}
to {
background-color: inherit;
}
}
JavaScript
window.location.hash = "foo";
function highlight() {
let id = window.location.hash.substr(1);
let node = document.getElementById(id);
if (node) {
node.classList.add('flash');
}
}
highlight();