• Resolved booogiewoo

    (@booogiewoo)


    Hi guys,

    Thank you for the beautiful theme.

    I have created anchor links within the main menu and noticed that the mobile menu does not close after selecting an item. If I don’t use anchor links, the page reloads and the menu is “closed” but I can’t get it to close automatically with anchor links.

    Edit: I created a short video showing the issue: https://imgur.com/a/Cz9NQd8

    Do you have any idea how to solve the problem?

    Best
    BW

    • This topic was modified 2 years, 7 months ago by booogiewoo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    To auto-close the mobile menu while one-page-menu link is clicked requires additional script. Please try:

    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($){
      
      $(document).on('click', '#mainnav-mobi li a[href^="#"]', function(e) {
        
        $('#mainnav-mobi').slideToggle(300);
        e.stopImmediatePropagation()
        
      });
    
    })(jQuery);
    

    4. Update and clear any cache

    Thread Starter booogiewoo

    (@booogiewoo)

    Hi Kharis,

    Thank you so much for your support.

    Unfortunately, I was unable to get this code to work, but now I got the wanted behavior using this string:

    jQuery('.menu-item').on( "click", function() {jQuery('#mainnav-mobi').hide()})

    Also thanks for the suggested plugin. Since I am already using the Advanced Ads plugin I also implemented this custom footer code injection with it. Works like a charm.

    All the best!
    BW

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide menu after click’ is closed to new replies.