I’m using custom jquery trigger code on menu items. I’m basically loading part of contents of href into a div with ajax. For this to work, I have to do a .preventDefault(). However, this disables the menu’s built-in function of hiding the menu on click. Is there a way I can call this function directly? I tried to add a handler on the mobile menu item directly, but that doesn’t work since onload, it’s display:none, so doesn’t exist.
Even if the only thing I do on my trigger is the .preventDefault(), the menu hiding behaviour is compromised. However, that does not happen is my href is simply “#”. I need to keep the hrefs intact for search engines and other reasons.
So how could I “manually” trigger the closing of the menu?