I'm trying to hover over each column on the right side and have them expand while the rest contract. The issue is if the purple one is currently transitioning to a contracted state, and I quickly hover over to the blue one, they all contract.
The goal would be to have the blue one simultaneously open while the others contract. Open to using JS.
Here's an example, try having purple fully expanded and then quickly going to the blue column:
https://codepen.io/niko-dellic/pen/MWvvGMz
#wrapper {
height: 100vh;
display: flex;
flex-direction: row;
transition: 1s ease-in-out;
}
#wrapper>* {
flex: 0 1 2vw;
/* outline: 0; */
transition: 1s ease-in-out;
border: 1px solid black;
}
#wrapper>div:hover {
/* flex: 1 1 33vw; */
flex-grow: 1;
transition: 1s ease-in-out;
}
#wrapper>#open {
/* flex: 1 1 1vw; */
flex-grow: 2;
transition: 1s ease-in-out;
}
#wrapper>#closed {
transition: 1s ease-in-out;
}
<div id="wrapper">
<div class='chapter' style="background-color:red;"></div>
<div class='chapter' id="open"></div>
<div class='chapter' style="background-color:blue;"></div>
<div class='chapter' style="background-color:green;"></div>
<div class='chapter' style="background-color:purple;"></div>
</div>