JSFiddle - React, Tailwind, and code Playground

by Abra Cadabra

HTML

<div id="fututed" class="transitioned">
    <button>apasa dreq</button>
    <div id="will-expand" class="transitioned"></div>
</div>

CSS

#fututed{
    border: 2px solid red;
    width: 500px;
    height: 500px;
    margin: 0 auto;
    position: relative;
}
#will-expand{
    border: 2px solid blue;
    width: 0px;
    right: 500px;
    top: -2px;
    height: 150px;
    position: absolute;
}

#will-expand.expanded{
    width: 100px;
    right: 400px;
}
#fututed.will-futate{
    width: 400px;    
}

.transitioned{
    -webkit-transition: all 1s ease-in-out;
    -moz-transition: all 1s ease-in-out;
    -o-transition: all 1s ease-in-out;
    transition: all 1s ease-in-out;
}

JavaScript

$("button").on('click', function(e){
    e.preventDefault();
    
    $("#will-expand").toggleClass('expanded');
    $("#fututed").toggleClass('will-futate');
})