JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://raw.github.com/dperini/ContentLoaded/master/src/contentloaded.js"></script>
<header class="container">
<a href="index" class="brand"><div class="logo"></div></a>
<nav>
<a href="index" class="active">Home</a> |
<a href="about-us" class="active">About Us</a> |
<a href="contact-us" class="active">Contact Us</a>
</nav>
</header>
CSS
.active { color: aqua }
JavaScript
(function(window, document, undefined) { contentLoaded(window, function() {
//var page = document.location.pathname.match(/[A-z]+$/)[0],
var page = 'http://example.com/index',
nav_anchors = document.getElementsByTagName('header')[0]
.getElementsByTagName('nav')[0]
.getElementsByTagName('a');
for(i in nav_anchors)
if(nav_anchors[i].href.match(/[A-z]+$/)[0] = page)
nav_anchors[i].classList.add('active');
})
})(this, this.document)