Created
March 30, 2013 21:13
-
-
Save timrwood/5278356 to your computer and use it in GitHub Desktop.
Active class on click.
This file contains hidden or 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
var nav = $('nav'); | |
$(window).on('click', function (e) { | |
// we clicked inside the nav | |
if ($(e.target).closest(nav).length) { | |
nav.addClass('active'); | |
} else { | |
nav.removeClass('active'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment