What i want to achieve:
- Opening a submenu element when clicked and not when hovered as it natively does
- Disabling parent/main nav item redirection to page when clicked
How i want to achieve it:
I have noted that when a sub-menu exists, a function from the theme an x-active
class to a few elements and that is what triggers the subelement list visualization.
I wanted to disable this event by using the code below and it almost works, but there seems to be another element that still adds the x-active
.
jQuery( "#mainnavbar .x-anchor-text-primary, #mainnavbar .x-anchor-sub-indicator, #mainnavbar .menu-item-has-children, #mainnavbar .x-anchor, #mainnavbar .x-anchor-content, #mainnavbar .x-dropdown" ).hover(
function(e) {
// Mouse Enters
console.log('hover was entered!');
e.stopPropagation();
e.preventDefault();
});
What i need from you:
I don’t really need you to write the code for me (but if you have one, then feel free to share it!) but i’d like to know HOW you add this behaviour, is it through a JS function? if it is then where can i find it? maybe i can understand better how to overwrite it
why:
The above code almost works, however if you hover over certain zones like in the margin zone of the subindicator or around the edges of the element, the content is triggered which makes me believe that the original code works in a different way
NOTE: I want to leave clear that i don’t need you to write the code for me (i know that’s out of the scope of the support), I just need to know your logic and maybe have some references, so i can figure what to do next.