I’m currently using a single page javascript navigation menu, how to highlight current link.
I use a single page navigation menu for my Intranet site (offline) and want to find a simple
way to automatically highlight the “current” link.
Here is an example of my current Nav menu:
NavLinks.js:
var lnk = ‘ ‘;
lnk+='<br>’;
lnk+='<ul><b><font size=”5″>Customer Links:</b></font>’;
lnk+='<li><a href=”../customerpages/Customer1.html”>Customer 1</a></li>’;
lnk+='<li><a href=”../customerpages/Customer2.html”>Customer 2</a></li>’;
lnk+='<li><a href=”../customerpages/Customer3.html”>Customer 3</a></li>’;
lnk+='</ul>’;
document.write(lnk);
It loads using the following HTML:
<script type=”text/javascript” src=”../javascript/NavLinks.js”></script>
And I can manually add the following CSS to each page to get them highlighted, but I want to avoid added something to every single page:
CSS:
a.current { color: #ffffff; background:#f1d74c; }