summaryrefslogtreecommitdiff
path: root/public/js/nav_highlight.js
blob: b8ebb090c90c9c1d432bae2f4f01047bde8a8210 (plain)
1
2
3
4
5
6
7
8
9
document.addEventListener( 'DOMContentLoaded', function() {
  var url = window.location.href;
  var navs = document.getElementsByTagName("nav")[0].getElementsByTagName("a");
  for (var i = 0; i < navs.length; i++) {
    if (url.startsWith(navs[i].href)) {
      navs[i].classList.add('active');
    }
  }
});