Created
November 13, 2015 20:03
-
-
Save josiahwiebe/5face07c3763edc160c4 to your computer and use it in GitHub Desktop.
Make clicked nav item active while deactivating all others
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() { | |
$('nav ul li').click(function(e) { // when clicking on the first level li | |
$('nav ul li div').removeClass('menu-is-visible'); // first remove the visible class any child div | |
$(this).children('div').addClass('menu-is-visible'); // then add the visible class to the current child div | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment