Ive got a menu and a drop-down panel. When hovering over the menu the panel falls down. I want the menu and the drop down to be highlighted at the same time.
My code is working very nicely but when hover over the menu the highlighting for the menu adds and wont vanish when you hover out from the menu.
<script type="text/javascript">
$(window).load(function () {
$(".menu-item").hover(function () {
$(".menu-item").removeClass('menuHighlighted');
$(this).addClass('menuHighlighted');
});
$(".panel-item").hover(function () {
$(this).addClass('listHighlighted');
$(this).parents('.menu-item').addClass('menuHighlighted');
},
function () {
$(this).removeClass('listHighlighted');
$(this).removeClass('menuHighlighted');
});
});
</script>
I believe im almost done, there is just one little thing left that i cant figure out. I have been trying to add:
$(".menu-item").mouseleave(function () {
$(this).removeClass('menuHighlighted');
});
But that wont work. Any other suggestions would help me.