JSFiddle - React, Tailwind, and code Playground
HTML
<div class="toggle" style="display: block; width: 200px; height: 200px; background-color: red;">test</div>
JavaScript
jQuery(document).ready(
function()
{
jQuery(".toggle").on("click", function() {
console.log("let the toggling begin!");
jQuery(this).slideToggle(600, function(){ // slide up
setTimeout(function(){ // wait 4 sec, then slide back down
jQuery(this).slideToggle(600)
}, 4000);
});
});
}
);