'WordPress menu closes too fast on smartphone

Hi currently making a website for a client using the getaway theme. But when I resize my browser to a mobile phone and open the menu it opens and then closes really quickly. I have added in the following code into the theme repo:

jQuery(document).ready(function($) {
   $('.x-nav .menu-item a').off('click');
   $('.x-nav .menu-item a').click(function() {
      return true;

This unfortunately did not work. the link to the website is leisurely.in any help is greatly appreciated.



Solution 1:[1]

Your mobile navigation menu (i guess its class name qodef-mobile-nav) on display: "none" state. So you need add the "active" class that change it to display: "block", when you click the button menu (class name qodef-mobile-menu-opener)

So your code should be something like this

jQuery(document).ready(function($) {
   $('.qodef-mobile-menu-opener').click(function() {
      $('.qodef-mobile-nav').classList.toggle("qodef-mobile-nav-active")
  }
}

This link might be helpful https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 catchman