JSFiddle - React, Tailwind, and code Playground

HTML

<a id="toggle" href="#">TEST</a>
<div id="example">
</div>

CSS

body {
     background: red;                    
}

#example {
    position: absolute;
    width: 100px;
    height: 100px;
    left: 50%;
    margin-left: -50px;
    top: 50%;
    margin-top: -50px;
    background: white;
}

JavaScript

$(document).ready(function() {
    var toggle = 0;
});
$("#toggle").click(function() {
    if (toggle == 0) {
        $("#example").animate({"height":"300px","margin-top":"-150px"}, 500);
        toggle = 1;
    } else {
        $("#example").animate({"height":"100px","margin-top":"-50px"}, 500);
        toggle = 0;
    }
});