I have a menu on the top of a page, I need an overlay at the background with black color and and opacity = 0.7
, this "overlay" has to appear at li:hover
(mouseenter
) and disappear at mouseleave
. This is what I've done so far jsfiddle and this is the fullscreen result
What I got:
mousenter
works well.mouseleave
issue, the overlay appears and disappear everytime the mouse leave (it seems a party flashing div), I know is logic, but what can I do?
If I comment some lines in the code I see what I want but the overlay stays visible.
function iniciarmenu() {
$(".menu-links ul li").hover(
function () {
$(".overlay").animate({
opacity: 0.7
}, 'fast');
},
function () {
/*$(".overlay").animate({
opacity: 0
}, 'fast');*/
});
}
I hope you can help me. Thanks!