flex grow animation
HTML
<div class="container">
<div class="item" style="background: red">afffffff</div>
<div class="item" style="background: green">fffffffb</div>
<div class="item" style="background: blue">cffffff</div>
<div class="item" style="background: purple">dffffffff</div>
</div>
CSS
.container {
flex-grow: 1;
flex-shrink: 0;
flex-basis: auto;
display: flex;
flex-direction: column;
height: 100%;
}
.item {
flex-grow: 20;
height:25%;
transition: all 0.5s;
}
.collapse {
flex-grow: 1;
}
html, body {
width: 100%; height: 100%;
margin: 0; padding: 0; border: 0; overflow: hidden; }
JavaScript
$(".item").click(function() {
$(this).removeClass('collapse');
$(".item").not(this).each(function() {
$(this).addClass("collapse");
});
});