JSFiddle - React, Tailwind, and code Playground

by wirey00

HTML

<button class='toggle1'>click</button>
<div class='panel1'></div>

CSS

.panel1 {
    height: 100px;
    width: 100px;
    background-color: red;
}

JavaScript

$('.toggle1').click(function () {
    var panel = $('.panel1');
    if(panel.is(':animated')){
        return false;   
    }
    var curH = panel.height();
    panel.animate({
        height: curH == 20 ? 100 : 20
    }, 1000);
});