I am facing an issue with two menus that can be toggled using a switch. Each menu item has a dropdown that appears when clicked. The problem arises when switching between the menus, as there is an animation for the transition (slide in and slide out). I want this sliding animation to only occur within the menu element, so I used overflow-y: hidden;
. However, this causes my dropdown menus to be cut off since they are contained within the parent with overflow: hidden
.
I have created a codepen demonstrating the problem here:
https://codepen.io/twan2020/pen/jOMMoom
Switching between the menus shows that the animation overflows the menu container.
When I apply the following code, the animation works smoothly but the menu no longer opens when clicking on an item:
.categoriemenu .categorielijst {
width: 100%;
margin-bottom: 0px;
display: flex;
justify-content: space-evenly;
position: relative;
overflow-y: hidden;
}
Is there a way to fix this issue without setting the product-menu
(dropdown menu) to position:fixed
, which breaks the styling? My menu also has variable heights, so I am looking for a simpler solution to resolve this problem.