I have a normal menu with a dropdown option, developed in the following way:
ul > li.dropdown > ul.dropdown-content {
display: none;
position: absolute;
background-color: red;
min-width: 100px;
}
ul > li.dropdown:hover > ul.dropdown-content {
display: block;
}
When I try to add an animation with fadeIn
and fadeOut
functions to the dropdown-content, strangely jQuery doesn't add the opacity for the achievement of the animation to the dropdown-content element. If I remove display:block
from CSS and make handle the hide/block of the element by jQuery, it works suddenly.
There's a way to animate an element that work both in CSS and jQuery? In order to have a fallback if jQuery doesn't load or the user have javascript disabled.
Working animation: Fiddle Not working animation (with CSS Fallback): Fiddle