Created
April 24, 2019 17:41
-
-
Save halfnibble/5634d9207ab85500cd573765853963ba to your computer and use it in GitHub Desktop.
Responsive nav jQuery code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
let menu = $('nav > ul'), | |
menuLink = $('#mobile-menu a'); | |
menuLink.on('click', function() { | |
if (menu.hasClass('closed')) { | |
menu.removeClass('closed'); | |
menu.addClass('open'); | |
} else { | |
menu.removeClass('open'); | |
menu.addClass('closed'); | |
} | |
}); | |
let subMenu = $('.submenu'), | |
subMenuLink = $('.submenu-link'); | |
subMenuLink.on('click', function() { | |
$(this).parent().find('.submenu').toggle(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment