JSFiddle - React, Tailwind, and code Playground

by Amitabha Ghosh

HTML

<button id="myClick">Click Me</button>
<div class="a"></div>

CSS

.a{
    position:relative;
    width: 200px;
    height: 100vh;
    background: red;
    transition: all ease 0.5s;
}
.c{
    background:#000;
    
}
.c:before{
    content:'Leave';
    color:#fff;
    display: block;
    height:10px;
}
.b{
    width:20px;
    transition: all ease 0.5s;
}

JavaScript

$('#myClick').click(function(){
$('.a').toggleClass('b');
    $(this).toggleClass('c');
});