JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<div class="outer">
<div class="middle">
<div class="inner" id="a">1</div>
<div class="inner" id="b">2</div>
<div class="inner" id="c">3</div>
</div>
</div>
<div class="wrapper">
CSS
div.inner {
max-width: 0;
display:table-cell;
overflow:hidden;
}
div.outer {
display:table;
overflow:hidden;
width:100%;
height:100%;
}
div.middle {
display:table-row;
overflow:hidden;
}
#holder{
width:100%;
height:100%;
margin: 0px auto;
overflow: hidden;
position: fixed;
}
#a{
width:auto;
height:100%;
background-color:red;
}
#b{
width:auto;
height:100%;
background-color:blue;
}
#c{
width:auto;
height:100%;
background-color:green;
}
.wrapper{
height:90vh;
overflow:hidden;
}
JavaScript
$('#a').click(function(){
$(this).animate({width:'80%'});
$('#b').animate({width:'10%'});
$('#c').animate({width:'10%'});
$(this).css({
'opacity': '1',
});
$('#b').css({
'opacity': '0.6',
});
$('#c').css({
'opacity': '0.6',
});
});
$('#b').click(function(){
$(this).animate({width:'80%'});
$('#a').animate({width:'10%'});
$('#c').animate({width:'10%'});
$(this).css({
'opacity': '1',
});
$('#a').css({
'opacity': '0.6',
});
$('#c').css({
'opacity': '0.6',
});
});
$('#c').click(function(){
$(this).animate({width:'80%'});
$('#a').animate({width:'10%'});
$('#b').animate({width:'10%'});
$(this).css({
'opacity': '1',
});
$('#a').css({
'opacity': '0.6',
});
$('#b').css({
'opacity': '0.6',
});
});