I implemented a toggle menu using the source code from my actual project to avoid any confusion:-
div.btn-dropdown-options {
font-family: "Haas Grot Text R Web", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 20px;
position: absolute;
z-index: 1;
bottom: calc(100% + 8px);
left: 0;
min-width: 180px;
margin-top: 4px;
padding: 8px;
border: 1px solid rgba(0,0,0,0.05);
border-radius: 8px;
background: #fff;
display: none;
-webkit-box-shadow: 0 0 5px 1px rgb(0 0 0 / 10%);
box-shadow: 0 0 5px 1px rgb(0 0 0 / 10%);
}
full code here: - https://jsfiddle.net/bnpehzjw/
.
To add a CSS transition effect for div.btn-dropdown-options, I changed visibility: hidden; to visibility: visible;.
Initially, when clicking on the menu toggle to show the menu, the transition works smoothly. However, when attempting to hide the menu by clicking the menu toggle again, the transition fails to work.
What could I have done incorrectly?