I recently began learning Javascript, and I am facing a challenge with this particular script:
// Maintaining Focus on Website Menu //
function menuFocus() {
$('#menu').addClass('hover');
}
function menuBlur() {
$('#menu').removeClass('hover');
}
$(document).ready(function() {
$('#submenu-mgmt').hover(menuFocus,menuBlur);
});
$(document).ready(function() {
$('#submenu-label').hover(menuFocus,menuBlur);
});
The main goal is to implement a 'hover' effect on a non-sibling DIV ID when a user hovers over a secondary menu system using two distinct DIV IDs. In my design, there are 3 DIV IDs involved: '#Menu' represents the header menu section, while '#Submenu-Mgmt' and '#Submenu-Label' remain hidden initially and can be accessed by clicking a link that toggles their visibility.
This feature is intended for a live webpage, and although it may not be critical for the site's functionality, it would add a nice touch as currently, the menu area loses focus when users hover over the submenus.
Link to the page in question: .