JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div id="content">
This is some content
</div>
</div>
CSS
.container {
text-align: right;
width: 400px;
}
#content {
width: 10px;
height:20px;
background-color:red;
overflow: hidden;
float:right;
}
JavaScript
var width;
$('#content').click(function(){
if($(this).hasClass('open')){
$(this).removeClass('open');
width = "10px";
} else {
$(this).addClass('open');
width = "300px";
}
$(this).animate({
width: width
}, 200, function() {
});
});