The menu stays open when I click the link - Mobile view

Hello

I have a new WEBSITE.

The menu does not close when I click the link. I would like that the menu closes when you click the link.

Thank you & Best regards,
BR

Hi,

Try these steps:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box
    (function($){

      'use strict'

      $('.btn-menu').on('click', function() {
        var navBlock = $('#mainnav-mobi');

        if (navBlock.is(':visible')) {
            $(window).trigger('slideMenuOpen');
        } else {
            $(window).off( 'slideMenuOpen' );
        }

      });

      $(window).on('slideMenuOpen', function() {

        $('#mainnav-mobi .menu-item a').click(function(){
          $('#mainnav-mobi').slideUp();
          $(window).off( 'slideMenuOpen' );
        });

        $('.btn-menu, #mainnav-mobi').click(function(event){
          event.stopPropagation();
        });

      });

    })(jQuery);
  1. Update

Regards,
Kharis
aThemes Support

Thank you Kharis

I tried it, but it did not work.

Thank you for your help & Best regards,
BR

The problem is there only in my mobile view.

I have a sticky menu header and this happens only for the links on the same page where the link in menu is.

Thank you for your help & Best regards,
BR

Hi,

Thank you for trying.

As checked with your website’s source code, seems likely you’re having a cache enabled. It may prevent web browser to recognize the added script for only cached pages are loaded. Thus you need to flush cache, clear web browser history and restart it, each time custom script added.

I request giving it a try and let me know your views.

Regards,
Kharis
aThemes Support

I tried to cache the site. I even loaded the Wp optimize plugin and cleaned the site, and then deactivated the plugin, but it is still the same.

Hi,

Thank you for getting back.

I think I should investigate and troubleshoot the code directly from your site. Just in case it is related to site specific issue. Thus I request sharing your website’s temporary admin login link and send it privately to me over direct message. You can generate the link with this plugin.

P.S.: Ensure the link expiry is set to 7 days and all admin rights are enabled.

Regards,
Kharis
aThemes Support