JSFiddle - React, Tailwind, and code Playground

by Minko Gechev

HTML

<div id="elem">Text</div>
<button>Toggle</button>

CSS

#elem {
    width: 140px;
    height: 140px;
    background-color: #DE7E32;
    border-color: #FFAC6B;
    border-style: solid;
    border-width: 0px;
    overflow: hidden;
}

JavaScript

var small = false;
$('button').click(function () {
    if (small) {
        $('#elem').animate({
            width: 140,
            height: 140,
            fontSize: '1em',
            borderWidth: 0,
            marginLeft: 0
        });
        small = false;
    } else {
        $('#elem').animate({
            width: 20,
            height: 20,
            fontSize: '8em',
            borderWidth: '30px',
            marginLeft: 100
        });
        small = true;
    }
});