Mobile Submenu Auto Closes

Hi,

I was wondering if you could assist with Submenu’s on mobiles. They are working fine however if I click to expand this is causing the mobile menu to close & when clicked on again the submenu is open.

I had this code I used to use for this however it no longer works.

jQuery(document).ready(function($) {
var subMenuLink = $(’.x-navbar .mobile .x-nav li.menu-item-has-children > a’);

subMenuLink.on(‘click touchstart’, function(e) {
e.preventDefault();
var $this = $(this);
$this.find(’.x-sub-toggle’).off(‘click touchstart’);
$this.closest(‘li.menu-item-has-children’).toggleClass(‘x-active’);
$this.siblings(’.sub-menu’).slideToggle(300);
});
});

I will send website credentials privately

Hi Philip,

The mobile menu in X theme does not have any problem like the one you described. I checked that on my installation and two other ones and there is no such a problem that submenu closing the whole menu.

This must be caused by a customization that you have done on your website.

Please remove any JavaScript and CSS code that you’ve added to the website and change the theme from the child to parent one.

After that please test the website regarding the mobile menu. If it is working okay for you then you need to bring back your customization step by step to find which one is causing the issue.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.