JSFiddle - React, Tailwind, and code Playground

by Laxmikant Dange

HTML

<button id="hideDiv">Hide Div</button> </ br>
<div class="firstClass"></div>

CSS

.firstClass{
    width:100px;
    height:100px;
    border:1px solid #F00;
    background-color:#eaeaea;
}

.firstClass.secondClass{
    transition:all linear 0.5s;
}

.firstClass.thirdClass{
    width:0px;
}

JavaScript

$(function(){
	$("#hideDiv").on('click',function(){
        $('.firstClass').addClass('secondClass');
        setTimeout(function(){
				$('.firstClass').removeClass('secondClass').addClass('thirdClass')
        })
    });
});