-
-
Save Mindgames/8324b97ae1e128370a712fa4344aad21 to your computer and use it in GitHub Desktop.
Add `.current` class to anchors that link to the current URL.
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
//gist.github.com/ryanve/6153436 | |
(function(anchors, url, i, a) { | |
while ((a = anchors[i++]) && a.classList) | |
a.href === url && a.classList.add('current'); | |
}(document.getElementsByTagName('a'), location.href, 0)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment