Skip to content

Instantly share code, notes, and snippets.

@cjkoepke
Last active December 6, 2015 15:07
Show Gist options
  • Save cjkoepke/794e5c7e6835a5fb4ac3 to your computer and use it in GitHub Desktop.
Save cjkoepke/794e5c7e6835a5fb4ac3 to your computer and use it in GitHub Desktop.
jQuery( document ).ready( function( $ ) {
// @author Calvin Koepke (@cjkoepke)
// @link http://www.calvinkoepke.com/add-a-mobile-friendly-off-canvas-menu-in-genesis/
// @version 1.1
// @license Free to use as you wish. Please share if you appreciate and link to the post above.
// Store our jQuery objects as variables
var body = $( 'body' ),
toggleButtons = $( '.menu-btn, .close-btn, .site-overlay' );
toggleButtons.click( function( event ) {
// Prevent the default action of clicking a link
event.preventDefault();
// Toggle our main body class depending on whether it is present (false by default)
body.toggleClass( 'off-canvas-active' );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment