Skip to content

Instantly share code, notes, and snippets.

@hirejordansmith
Created September 24, 2014 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirejordansmith/b219d1fbc7d745626dc0 to your computer and use it in GitHub Desktop.
Save hirejordansmith/b219d1fbc7d745626dc0 to your computer and use it in GitHub Desktop.
Create Sidebar Toggle Menu with jQuery
jQuery(document).ready(function($) {
$('#menu-main-menu a').click(function( event ){
var visibleSubmenu = $('#menu-main-menu ul.sub-menu:visible');
var submenu = $(this).next('ul.sub-menu');
if( submenu.length >= 1 ) {
event.preventDefault();
visibleSubmenu.slideUp();
submenu.slideToggle();
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment