JSFiddle - React, Tailwind, and code Playground

HTML

<div id="left"></div>
<div id="right"></div>

CSS

div {
	cursor: pointer;
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 0;
}
#left {
	background: #666;
    left: 0;
    right: 50%;
}
#right {
	background: #063;
    right: 0;
    left: 50%;
}

JavaScript

$('div').click(function () {
    $(this).css('z-index', 1);
    if (this.id === 'right') {
        $(this).animate({left: 0}, 2500);
    } else {
        $(this).animate({right: 0}, 2500);
    }
});