Instantly share code, notes, and snippets.

Embed
What would you like to do?
_s theme: multiple menus on a page
/**
* Handle multiple menus on one page
*/
(function($){
$('document').ready(function(){
$('.main-navigation .menu-toggle').on('click', function(){
$(this).toggleClass('toggled');
var $nav = $(this).parents('.main-navigation'),
$ul = $nav.find('ul.menu');
if ($(this).hasClass('toggled')) {
$nav.toggleClass('toggled').attr('aria-expanded', true);
$ul.attr('aria-expanded', true);
} else {
$nav.toggleClass('toggled').attr('aria-expanded', false);
$ul.attr('aria-expanded', false);
}
});
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment