Hide Genesis Responsive Menu On Menu Item Click

This solution enables you to hide the Genesis responsive menu when any menu item in the drop down toggle menu is clicked. Once the menu item is clicked, the entire drop down is closed and the responsive menu icon ( hamburger menu ) can then be opened again as seen in the demo video.

Demo Video

In this case, the menu items for scroll points on the front page are clicked resulting in the responsive menu closing.

Tested using the Altitude Pro child theme by StudioPress however will work in any StudioPress child theme. Coded to load on the front page only.

Installation Steps

There’s 2 steps :

  1. # Upload the file named menu.js to your child themes root directory like this :
  2.  
    Step 1

  3. # Copy & paste the PHP code ( without the opening PHP tag ) from the functions.php file to the end of your child themes functions file.
  4.  
    Step 2

Download Folder


Comments

9 responses to “Hide Genesis Responsive Menu On Menu Item Click”

  1. Tim Baggaley Avatar
    Tim Baggaley

    Hello Brad,
    I’m using the Genesis One-Pager child theme and because this uses local links I really need the responsive menu to close on click. I’ve tried out your code here but I can’t get it to work. Do I need something different for One-Pager?

    You can see my website at: https://timbaggaley.com/

    Thanks, Tim

    1. Do you have some sort of caching active or CSS min? Is One Pager a StudioPress theme?

      1. Tim Baggaley Avatar
        Tim Baggaley

        Yes, I do have caching and CSS min active. One-Pager is not a StudioPress theme:

        1. Turn caching and minification off please.

          The code only works in StudioPress themes. Any work required to use the code in non SP themes is billable.

          Tested in Genesis Sample version 3.4.1 and earlier and works.

  2. Jacob Vanderpol Avatar
    Jacob Vanderpol

    Hi,

    This solution does not work on the latest Genesis Version (3.3.3) with the Genesis Sample child theme. Can you provide an updated version that does work in this set-up?

    Thanks!

    1. Hi Jacob. What version of Genesis Sample are you using? Also, 3.3.5 is the latest version of Genesis.

      1. Jacob Vanderpol Avatar
        Jacob Vanderpol

        Version 3.4.0.

        Inspector in Chrome shows the following error:

        Uncaught TypeError: $ is not a function
        at menu.js?ver=3.4.0:8
        at dispatch (jquery.min.js?ver=3.6.0:2)
        at v.handle (jquery.min.js?ver=3.6.0:2)

        1. Please use this latest version which has 2 versions in the file. One for AP and one for Sample. Just tested on latest versions.

          1. Jacob Vanderpol Avatar
            Jacob Vanderpol

            Works great! Thanks!

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.