JSFiddle - React, Tailwind, and code Playground
HTML
<div id="slideout">
<div id="slidecontent">
Yar, there be dragonns herre!
</div>
<div id="clickme">
</div>
</div>
CSS
body {
overflow-x: hidden;
}
#slideout {
background: #666;
position: absolute;
width: 280px;
height: 80px;
top: 45%;
right:-280px;
padding-left: 20px
}
#clickme {
position: absolute;
top: 0; left: 0;
height: 20px;
width: 20px;
background: #ff0000;
}
#slidecontent {
float:left;
}
JavaScript
$(function () {
var rightVal = -280;
$("#clickme").click(function () {
rightVal = (rightVal * -1) - 280;
$(this).parent().animate({right: rightVal + 'px'}, {queue: false, duration: 500});
});
});