JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="bp"></div>
</div>
CSS
.container {
background: #FF0000;
width: 200px;
height: 200px;
position: relative;
}
.container.hide {
width: 50px;
}
.bp {
background: #00FFFF;
width: 30px;
height:30px;
top:0px;
right:0px;
position:absolute;
cursor: pointer;
}
.bp:hover {
background: #0000FF;
}
JavaScript
$(document).ready(function() {
$('.bp').click(function() {
if($('.container').hasClass('hide')) {
$('.container').removeClass('hide');
}
else {
$('.container').addClass('hide');
}
});
});