JSFiddle - React, Tailwind, and code Playground

by Plippie Plop

HTML

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

CSS

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

.container {
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: auto;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.item {
    flex:0 0 25%;
    transition: all 1s;
}

.collapse {
   flex:0 0 50%;
   
}

JavaScript

$(".item").on('click',function() {
    var $this = $(this);
    $this.addClass('c')
    });
    
    
});