How can I get my submenu items to not collapse the menu on mobile when clicked?

Hi I have added the following to make my mobile menu collapse when a menu item is clicked

jQuery(document).ready(function($){
$(’.menu-item a’).click(function(){
$(’.x-nav-wrap.mobile’).removeClass(‘in’);
});
});

This works perfectly - BUT when a sub menu item is clicked it collapses so the sub menu item can’t be seen, any ideas?

Thank You

Hi there,

If I understood correctly you want the effect of Javascript stop to work for sub-menu items. If that is the case kindly change the code to this:



jQuery(document).ready(function($){
$('.x-nav > .menu-item > a').click(function(){
$('.x-nav-wrap.mobile').removeClass('in');
});
});

Hope it helps.