PublishingJS:TheNewSocial: Difference between revisions

From H&D Publishing Wiki
(Created page with "console.log( 'Hello from PublishingJS namespace!' )")
 
No edit summary
Line 1: Line 1:
console.log( 'Hello from PublishingJS namespace!' )
console.log( 'Hello from PublishingJS namespace!' )
var navLinks = document.querySelectorAll('nav > a');
window.onhashchange = function() {
    for (var i = 0; i < navLinks.length; i++) {
        if (navLinks[i].href.match(/(#.*)/)[1] == window.location.hash) {
            navLinks[i].className = 'selected';
        } else {
            navLinks[i].className = '';
        }
    }
};

Revision as of 13:54, 19 April 2023

console.log( 'Hello from PublishingJS namespace!' )

var navLinks = document.querySelectorAll('nav > a');

window.onhashchange = function() {
    for (var i = 0; i < navLinks.length; i++) {
        if (navLinks[i].href.match(/(#.*)/)[1] == window.location.hash) {
            navLinks[i].className = 'selected';
        } else {
            navLinks[i].className = '';
        }
    }
};