JSFiddle - React, Tailwind, and code Playground
HTML
<div id="hide">Hide</div>
<div id="header" class="ToBeShowed">This is a fixed header</div>
JavaScript
$("#hide").click(function() {
$(".ToBeShowed").fadeToggle("slow", "linear");
if ($(this).text() == 'Hide') {
$(this).text('Show');
}
else {
$(this).text('Hide');
}
});
});
if ($(".ToBeShowed").is(':visible'))
{
$("#hide").html("Click to hide");
}
if ($(".ToBeShowed").is(':hidden'))
{
$("#hide").text("Click to show");
}