Created
August 21, 2014 01:45
-
-
Save jtulk/f8fc762421835c2aea83 to your computer and use it in GitHub Desktop.
Attach .active to <a> tags in #main nav
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
activeMenuStyles = -> | |
loc = "/" + window.location.pathname.split("/")[1] | |
style = (link) -> | |
href = $(link).attr('href') | |
if href == loc | |
$(link).addClass('active') | |
menuLinks = $('#main > a') | |
style link for link in menuLinks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment