JSFiddle - React, Tailwind, and code Playground
HTML
<div class="box">
<div class="up"></div>
<div class="down"></div>
</div>
<a href="#" id="hidediv">Hide me</a>
CSS
.up{
width: 100px;
height: 100px;
background: orange;
display: block;
}
.down{
width: 100px;
height: 100px;
background: red;
display: none;
}
JavaScript
$("#hidediv").click(function(){
$(".up").slideUp(800);
$(".down").slideDown(800);
});