Created
May 4, 2016 15:26
-
-
Save andreasvirkus/0d95ad20df94a7160e0f6bda5e4a262c to your computer and use it in GitHub Desktop.
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
(function() { | |
var href = window.location.href, | |
parser = document.createElement('a'); | |
parser.href = href; | |
var pageUrl = parser.pathname, | |
navLinks = document.querySelectorAll('nav.docs-nav ul li a'); | |
[].slice.call(navLinks).forEach(function(link, i) { | |
var currentHref = link.getAttribute('href'); | |
if (currentHref == pageUrl) { | |
link.classList.add('active'); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment