JSFiddle - React, Tailwind, and code Playground
HTML
<box>test box</box>
CSS
box {
position:absolute;
background:red;
right:20px;
top:10px;
cursor:pointer;
transition: left 2s ease-out;
}
box.newpos {
right:unset;
left:500px !important;
}
JavaScript
$("box").css('left', $('box').position().left+'px')
$("box").css('width', $("box").width()+1)
$("box").click(function () {
$("box").toggleClass("newpos");
});