Support » Plugin: Responsive Menu - Create Mobile-Friendly Menu » Close Menu on anchor click

  • Resolved rmsgreig

    (@rmsgreig)


    I am trying to close the menu when somebody clicks and anchor link in the menu, I can get it to close but then it won’t re-open

    $('#responsive-menu-container li a').on('click', function(){
            $('#responsive-menu-container').hide();
    	    $('#responsive-menu-container li a').removeClass('active-now')
    	    $(this).addClass('active-now');
    	    $('#responsive-menu-button').removeClass('is-active');
    	    $('#responsive-menu-container').removeClass('responsive-menu-open');
    	    $('#responsive-menu-container').removeClass('slide-right');
    	    $('html').removeClass('responsive-menu-open');
      });
    
    $('#responsive-menu-button.is-active').on('click', function()
    							   {
    	$('#responsive-menu-container').show();
    	$('#responsive-menu-container').removeClass('slide-right');
    	$('#responsive-menu-container').removeClass('responsive-menu-open');
    	$('#responsive-menu-button').removeClass('is-active');
    	$('html').removeClass('responsive-menu-open');
    })

    Is there a better way to try to do this?
    Many Thanks

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Peter Featherstone

    (@peterfeatherstone-1)

    Hi there,

    There is a “Close page on link clicks” option in the Pro version available that does this.

    That javascript above does look quite convoluted for sure. Obviously I can’t give away the way it is done in the Pro version here.

    Unfortunately the javascript is a lot more complex than just hidding and showing things via CSS.

    All the best

    Peter

    thanks for your reply, will look at the options for getting the pro version

    Peter Featherstone

    (@peterfeatherstone-1)

    Hey there,

    You are welcome. If you need any help please let me know 🙂

    Peter

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Close Menu on anchor click’ is closed to new replies.