JSFiddle - React, Tailwind, and code Playground

HTML

<div id='A'></div>
<div id='B'><a href='javascript:' id='toggle'>Toggle</a></div>

CSS

#A, #B {
    position: absolute;
}
#A {
    top: 0px;
    width: 200px;
    bottom: 0px;
    background-color: lime;
}
#B {
    top: 0px;
    left: 200px;
    right: 0;
    bottom: 0px;
    background-color: pink;
}

JavaScript

$('#toggle').toggle(function(){
    $('#A').animate({width:0});
    $('#B').animate({left:0});
},function(){
    $('#A').animate({width:200});
    $('#B').animate({left:200});
})