• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

change centric menu in dropdown version

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › change centric menu in dropdown version

This topic is: not resolved
  • This topic has 2 replies, 1 voice, and was last updated 4 years, 11 months ago by glenkg.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • June 13, 2018 at 3:19 am #220788
    glenkg
    Participant

    Found a way to do this here: https://ozzyrodriguez.com/tutorials/genesis/genesis-responsive-menu-2-0/

    1. making responsive-menu.js file:

    ( function( window, $, undefined ) {
    	'use strict';
    
    	$( 'nav' ).before( '<button class="menu-toggle" role="button" aria-pressed="false"></button>' ); // Add toggles to menus
    	$( 'nav .sub-menu' ).before( '<button class="sub-menu-toggle" role="button" aria-pressed="false"></button>' ); // Add toggles to sub menus
    
    	// Show/hide the navigation
    	$( '.menu-toggle, .sub-menu-toggle' ).on( 'click', function() {
    		var $this = $( this );
    		$this.attr( 'aria-pressed', function( index, value ) {
    			return 'false' === value ? 'true' : 'false';
    		});
    
    		$this.toggleClass( 'activated' );
    		$this.next( 'nav, .sub-menu' ).slideToggle( 'fast' );
    
    	});
    
    })( this, jQuery );

    2. put this in function.php and change the prefix in mine:

    add_action( 'wp_enqueue_scripts', 'prefix_enqueue_scripts' );
    /**
     * Enqueue responsive javascript
     * @author Ozzy Rodriguez
     * @todo Change 'prefix' to your theme's prefix
     */
    function prefix_enqueue_scripts() {
    	wp_enqueue_script( 'prefix-responsive-menu', get_stylesheet_directory_uri() . '/lib/js/responsive-menu.js', array( 'jquery' ), '1.0.0', true ); // Change 'prefix' to your theme's prefix
    }

    3. add the css:

    /* Responsive Navigation
    ---------------------------------------------------------------------------------------------------- */
    
    /* Standard Navigation
    --------------------------------------------- */
    
    nav {
    	clear: both;
    }
    
    /* Navigation toggles
    --------------------------------------------- */
    
    .sub-menu-toggle,
    .menu-toggle {
    	display: none;
    	visibility: hidden;
    }
    
    /* Navigation toggles - Ensure Menu Displays when Scaled Up
    --------------------------------------------- */
    
    @media only screen and (min-width: 768px) {
    
    	nav {
    		display: block !important;
    	}
    }
    
    /* Navigation toggles - Mobile (Change max width as you see fit)
    --------------------------------------------- */
    
    @media only screen and (max-width: 767px) {
    
    	.menu-toggle,
    	.sub-menu-toggle {
    		display: block;
    		font-size: 20px;
    		font-size: 2rem;
    		font-weight: 700;
    		margin: 0 auto;
    		overflow: hidden;
    		padding: 20px;
    		padding: 2rem;
    		text-align: center;
    		visibility: visible;
    	}
    
    	button.menu-toggle,
    	button.sub-menu-toggle {
    		background-color: transparent;
    		color: #999;
    	}
    
    	.sub-menu-toggle {
    		padding: 18px;
    		padding: 1.8rem;
    		position: absolute;
    		right: 0;
    		top: 0;
    	}
    
    	.menu-toggle:before {
    		content: "\2261";
    	}
    
    	.menu-toggle.activated:before {
    		content: "\2191";
    	}
    
    	.sub-menu-toggle:before {
    		content: "+";
    	}
    
    	.sub-menu-toggle.activated:before {
    		content: "-";
    	}
    
    	nav {
    		display: none;
    		position: relative;
    	}
    
    	.genesis-nav-menu .menu-item {
    		background-color: #f5f5f5;
    		display: block;
    		position: relative;
    		text-align: left;
    	}
    
    	.genesis-nav-menu .menu-item:hover {
    		position: relative;
    	}
    
    	.genesis-nav-menu .sub-menu {
    		clear: both;
    		display: none;
    		opacity: 1;
    		position: static;
    		width: 100%;
    	}
    
    	.genesis-nav-menu .sub-menu a {
    		border-left: 0;
    		position: relative;
    		width: auto;
    	}
    
    	.genesis-nav-menu .sub-menu .sub-menu {
    		margin: 0;
    	}
    
    	.genesis-nav-menu .sub-menu .sub-menu a {
    		background-color: #f5f5f5;
    		padding-left: 30px;
    	}
    
    	.genesis-nav-menu .sub-menu .sub-menu .sub-menu a {
    		background-color: #fff;
    		padding-left: 40px;
    	}
    
    	.nav-primary a:hover,
    	.nav-primary .current-menu-item > a {
    		color: #333;
    	}
    
    }

    At first it did not make the hamburger icon collapse, but that was fixed by changing nav into #nav in the responsive-menu.js file and the css. But the submenus are not working because it does not recognize the menu-toggle (I think), the "+" and "-" are not showing or reacting. Any idea how to fix this? Would be greatly appreciated.

    June 13, 2018 at 3:23 am #220790
    glenkg
    Participant

    Found a way to do this here: https://ozzyrodriguez.com/tutorials/genesis/genesis-responsive-menu-2-0/

    1. making responsive-menu.js file:

    ( function( window, $, undefined ) {
    	'use strict';
    
    	$( 'nav' ).before( '<button class="menu-toggle" role="button" aria-pressed="false"></button>' ); // Add toggles to menus
    	$( 'nav .sub-menu' ).before( '<button class="sub-menu-toggle" role="button" aria-pressed="false"></button>' ); // Add toggles to sub menus
    
    	// Show/hide the navigation
    	$( '.menu-toggle, .sub-menu-toggle' ).on( 'click', function() {
    		var $this = $( this );
    		$this.attr( 'aria-pressed', function( index, value ) {
    			return 'false' === value ? 'true' : 'false';
    		});
    
    		$this.toggleClass( 'activated' );
    		$this.next( 'nav, .sub-menu' ).slideToggle( 'fast' );
    
    	});
    
    })( this, jQuery );

    2. put this in function.php and change the prefix in mine:

    add_action( 'wp_enqueue_scripts', 'prefix_enqueue_scripts' );
    /**
     * Enqueue responsive javascript
     * @author Ozzy Rodriguez
     * @todo Change 'prefix' to your theme's prefix
     */
    function prefix_enqueue_scripts() {
    	wp_enqueue_script( 'prefix-responsive-menu', get_stylesheet_directory_uri() . '/lib/js/responsive-menu.js', array( 'jquery' ), '1.0.0', true ); // Change 'prefix' to your theme's prefix
    }

    3. add the css:

    /* Responsive Navigation
    ---------------------------------------------------------------------------------------------------- */
    
    /* Standard Navigation
    --------------------------------------------- */
    
    nav {
    	clear: both;
    }
    
    /* Navigation toggles
    --------------------------------------------- */
    
    .sub-menu-toggle,
    .menu-toggle {
    	display: none;
    	visibility: hidden;
    }
    
    /* Navigation toggles - Ensure Menu Displays when Scaled Up
    --------------------------------------------- */
    
    @media only screen and (min-width: 768px) {
    
    	nav {
    		display: block !important;
    	}
    }
    
    /* Navigation toggles - Mobile (Change max width as you see fit)
    --------------------------------------------- */
    
    @media only screen and (max-width: 767px) {
    
    	.menu-toggle,
    	.sub-menu-toggle {
    		display: block;
    		font-size: 20px;
    		font-size: 2rem;
    		font-weight: 700;
    		margin: 0 auto;
    		overflow: hidden;
    		padding: 20px;
    		padding: 2rem;
    		text-align: center;
    		visibility: visible;
    	}
    
    	button.menu-toggle,
    	button.sub-menu-toggle {
    		background-color: transparent;
    		color: #999;
    	}
    
    	.sub-menu-toggle {
    		padding: 18px;
    		padding: 1.8rem;
    		position: absolute;
    		right: 0;
    		top: 0;
    	}
    
    	.menu-toggle:before {
    		content: "\2261";
    	}
    
    	.menu-toggle.activated:before {
    		content: "\2191";
    	}
    
    	.sub-menu-toggle:before {
    		content: "+";
    	}
    
    	.sub-menu-toggle.activated:before {
    		content: "-";
    	}
    
    	nav {
    		display: none;
    		position: relative;
    	}
    
    	.genesis-nav-menu .menu-item {
    		background-color: #f5f5f5;
    		display: block;
    		position: relative;
    		text-align: left;
    	}
    
    	.genesis-nav-menu .menu-item:hover {
    		position: relative;
    	}
    
    	.genesis-nav-menu .sub-menu {
    		clear: both;
    		display: none;
    		opacity: 1;
    		position: static;
    		width: 100%;
    	}
    
    	.genesis-nav-menu .sub-menu a {
    		border-left: 0;
    		position: relative;
    		width: auto;
    	}
    
    	.genesis-nav-menu .sub-menu .sub-menu {
    		margin: 0;
    	}
    
    	.genesis-nav-menu .sub-menu .sub-menu a {
    		background-color: #f5f5f5;
    		padding-left: 30px;
    	}
    
    	.genesis-nav-menu .sub-menu .sub-menu .sub-menu a {
    		background-color: #fff;
    		padding-left: 40px;
    	}
    
    	.nav-primary a:hover,
    	.nav-primary .current-menu-item > a {
    		color: #333;
    	}
    
    }

    At first it did not make the hamburger icon collapse, but that was fixed by changing nav into #nav in the responsive-menu.js file and the css. But the submenus are not working because it does not recognize the menu-toggle (I think), the "+" and "-" are not showing or reacting. Any idea how to fix this? Would be greatly appreciated.

    June 15, 2018 at 6:46 am #220854
    glenkg
    Participant

    I figured it out..

    Only problem I still have is with the submenu that gets off screen and does not scrol down.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble