brad.laboon.io/js/navbar.js

19 lines
481 B
JavaScript
Raw Permalink Normal View History

2014-11-20 14:40:37 -05:00
(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);
})();