I have this cart that contains .cartItem
children, with their CSS below :
.cartItemsContainer {
overflow: auto;
overflow-x: hidden;
padding: 10px;
transition: all .4s ease;
}
.cartItem {
display: inline-block;
position: relative;
width: 100%;
padding: 4px;
transition: all .4s ease;
}
.cartItemSlide {
padding-left: 350px;
opacity: 0;
}
I have this Javascript code that is executed when I delete a cart item :
// make it disappear with a CSS transition, then delete it when out of sight
cartItem.classList.add('cartItemSlide');
onTransitionEnd(cartItem, 'padding-left', () =>
{
cartItem.parentNode.removeChild(cartItem);
});
So I have my cart item that slides to the right, and is then deleted when this transition is over. The problem is that when the cart item is removed from the DOM, there is no height transition for my cartItemsContainer
I want the parent height to be smoothly reduced when its child is removed, how can I achieve this ?