Skip to content

Instantly share code, notes, and snippets.

@webmasterninjay
Created March 7, 2015 12:58
Show Gist options
  • Select an option

  • Save webmasterninjay/793bea46369816075453 to your computer and use it in GitHub Desktop.

Select an option

Save webmasterninjay/793bea46369816075453 to your computer and use it in GitHub Desktop.
Genesis Responsive Menu (jQuery)
( 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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment