I am currently utilizing jQuery to showcase a drop-down menu. It is successfully working for a single menu and displaying the appropriate drop-down. However, when I attempt to use more than one menu, it displays all of the drop-down menus simultaneously. I realize that I am passing the same class in jQuery, but how can I utilize the same class in multiple menus? Is this even possible?
Please take a look at my output in the provided snippet. Upon hovering over Menu-1, it also reveals the drop-down menus for Menu-2 and Menu-3. I aim to display a single drop-down upon hover. Can anybody provide assistance with jQuery?
Here is the code block from my snippet:
$(function() {
$(".menu").hover(
function() { $(".sub").slideToggle(400); },
function() { $(".sub").hide(); }
);
});
a{
text-decoration: none;
}
.menu{
font-family: Arial;
color: #515151;
position: relative;
background-color: #763E9B;
width: 100%;
color: #fff;
}
(menu styles continue...)
(pre-existing script goes here)