JSFiddle - React, Tailwind, and code Playground
HTML
<div class="status">hello there</div>
CSS
.status {
opacity: 0;
position: fixed;
top: -50px;
left: 100px;
padding: 10px 60px;
background-color: #f3f3f3;
border-left: 3px solid #828282;
border-right: 3px solid #828282;
border-bottom: 3px solid #828282;
color: #666;
border-radius: 0 0 5px 5px;
}
.status,
.status_active {
-webkit-transition: top 0.15s linear;
transition: top 0.15s linear;
}
.status_active {
top: 0px;
opacity: 1;
}
JavaScript
var _ = {
s: function(text) {
if (text == false) {
$('.status').removeClass('status_active');
return true;
} else {
$('.status').html(text);
$('.status').addClass('status_active');
}
}
}
$(document).ready(function() {
setTimeout(function() {
_.s('this is a test');
}, 1000);
setTimeout(function() {
_.s(false);
}, 3000);
});