JSFiddle - React, Tailwind, and code Playground
by slash197
HTML
<div id="adminmenuback">
<button class="collaps">toggle panel</button>
</div>
CSS
html, body {
height: 100%;
margin: 0px;
padding: 0px;
}
#adminmenuback {
background-color: #09f;
width: 300px;
height: 100%;
}
JavaScript
$('.collaps').click(function(){
if ($('#adminmenuback').width() != 30) // if it's not the minimal width then collapse
{
$('#adminmenuback').animate({width:"30px"});
}
else // if it is minimal then enlarge
{
$('#adminmenuback').animate({width: "300px"}); //change the width to what you need
}
});