• Hi guys,,
    Using sydney theme, no real alterations, and a one page style design. Im having problems closing the menu in mobile widths when a sub menu link with an anchor is clicked.
    I have tried adding some javescript to the footer but cant seem to get it working.

    Frustratingly the mobile menu hamburger icon does close the sub-menus on click.

    My html:

    <nav id=”mainnav-mobi” class=”mainnav collapse navbar-collapse” role=”navigation” style=”display: block;”>
    <div class=”menu-top-menu-container”>
    <ul id=”menu-top-menu” class=”menu”>
    <li id=”menu-item-238″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-238″>
    Services

    </div>
    </nav>

    Can anyone help?

    Thanks for your time

    Matt

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hello there,

    Try doing the below 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);
    

    4. Update

    Regards,
    Kharis

Viewing 1 replies (of 1 total)
  • The topic ‘One page site menu anchor not closing menu on sub menu click’ is closed to new replies.