Site icon Catch Themes

Mobile menu accordian for sub-menu

Hello Sakin My website is http://novelnatter.com My website will (eventually) have a large number of items in some of the sub-menus, so I would like to be able to open and close sub-menus in mobile view, otherwise the menu will become unwieldy. In order to do this, I have replaced the script adventurous-custom.min.js with adventurous-custom-child.min.js. This is fine and the existing scripts work as before. I tested my script in jsfiddle (see https://jsfiddle.net/hvy9wxy9/23/) and it works fine. However the IDENTICAL script in the theme, causes a problem whereby one of the if statements is running twice. Specifically, the if statement in the following function: jQuery("li.menu-item-has-children > a").click(function(event){ event.preventDefault(); if(jQuery(this).parent().hasClass("open")){ jQuery(this).next("ul").slideUp(500); jQuery(this).parent().removeClass("open"); } else { jQuery(this).next("ul").slideDown(500); jQuery(this).parent().addClass("open"); } }); You can see what I mean if you compare the mobile menu on my site with that on the fiddle. The fiddle submenus slide open and closed without issues. The website submenus slide open and immediately thereafter slide closed again, instead of staying open. I swear the code is identical. Any insight you can provide as to what could be causing this would be much appreciated. Thank you and regards, Ronel
Exit mobile version