flex grow animation

by kkdaily

HTML

<div class="container">
    <div class="item" style="background: red">a<br/>a<br/>a<br/>a<br/>a<br/>a<br/>a<br/>a<br/></div>
    <div class="item" style="background: green">b<br/>b<br/>b<br/>b</div>
    <div class="item" style="background: blue">c<br/>c<br/>c<br/>c</div>

</div>

CSS

.container {
    flex-grow: 10;
    flex-shrink: 0;
    flex-basis: auto;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.item { min-height:30px;
        /*flex-grow:0;
        flex-shrink:1;*/
        flex-basis:30px;
        transform: rotate(45deg);
        overflow-y:hidden;
        position: relative;
        transition: flex-basis 500ms ease-in-out;}
.expanded {
   flex-basis: 20em;
   /* no funciona con auto */
}



html, body {
    width: 100%;    height: 100%;
    margin: 0; padding: 0; border: 0; overflow: hidden;  }

JavaScript

$(".item").click(function() {
    $(this).addClass('expanded');
    $(".item").not(this).each(function() {
        $(this).removeClass("expanded");    
    });
    
    
});