JSFiddle - React, Tailwind, and code Playground
by Love Trivedi
HTML
<div id="window">
<div id="title_bar">
<div id="button">-</div>
</div>
<div id="box">
</div>
</div>
CSS
#window{
width:400px;
border:solid 1px;
}
#title_bar{
background: #FEFEFE;
height: 25px;
width: 100%;
}
#button{
border:solid 1px;
width: 25px;
height: 23px;
float:right;
cursor:pointer;
}
#box{
height: 250px;
background: #DFDFDF;
}
.bar{margin-top:50px;}
JavaScript
$("#button").click(function(){
if($(this).html() == "-"){
$(this).html("+");
$("#title_bar").animate({ marginTop: "0px" }, 500)
}
else{
$(this).html("-");
$("#title_bar").animate({ marginTop: "50px" }, 500);
}
});