Good day to the whole community. I am quite new in this web development, and when I was doing my page I presented a problem that I do not know how to solve.
I am trying to make a drop-down menu that when the event mouse-enter
of the element .menu-desplegable
is shown the menu is displayed and on the contrary when the event mouse-leave
of the same element is activated, the menu is hidden.
So far so good, but the problem is that I want to select the categories that will be in the future in the div
blue below (menu). But as it is obvious when the mouse-leave event of the .menu-desplegable
element is activated, this menu is hidden.
My question would be, how can I avoid hiding the menu below if I put the mouse on it, and hide it if I have the mouse outside the div
menu or outside the%% element%.
This is the code I've been carrying so far, it just hides and shows the menu by removing or putting the mouse over the .menu-desplegable
.
$(document).ready(function() {
$(".menu-desplegable").on("mouseenter", function() {
$("aside div.contenedor-aside").toggle(500);
});
$(".menu-desplegable").on("mouseleave", function() {
$("aside div.contenedor-aside").toggle(500);
});
});
I really have no idea how to start doing what I need, so I would really appreciate your help. Thanks.