My challenge lies in implementing a smooth transition effect for my drop-down menu using CSS. I want the menu to fade-in slowly and fade-out slowly when the user clicks on it. The menu is built with ul elements and starts off hidden. The visibility states are controlled by CSS styles, and toggled using JavaScript.
Here's my CSS styling :
.username-menu-hidden {
opacity: 0;
transition: visibility 0s 2s, opacity 2s linear;
display: none;
}
.username-menu-visible {
opacity: 1;
transition: opacity 6s linear;
display: block;
}
This is the menu code :
<ul class="username-menu username-menu-hidden" id="user-menu">
The onclick function successfully replaces "username-menu-hidden" with "username-menu-visible", however there is no visible transition effect as the menu just appears instantly.
P.S : Due to limitations, I am unable to use JQuery and must rely solely on CSS.