brad.laboon.io/js/navbar.js

19 lines
481 B
JavaScript

(function()
{
// Highlight the current page in the navbar
var highlightLink = function()
{
var links = document.getElementsByClassName("sidelink");
for (var i = 0; i < links.length; i++) {
if (links[i].href == location)
links[i].className += " sidelink-active";
}
}
// Attach onload handler
if (window.addEventListener)
window.addEventListener("load", highlightLink, false);
else if (window.attachEvent)
window.attachEvent("onload", highlightLink);
})();