Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.