Initial retro 2010 website
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
(function () {
|
||||
var activeLink = document.querySelector('.nav a.active');
|
||||
if (!activeLink) {
|
||||
return;
|
||||
}
|
||||
|
||||
var links = Array.prototype.slice.call(document.querySelectorAll('.nav a'));
|
||||
|
||||
function setActiveFromHash() {
|
||||
var hash = window.location.hash || '#start';
|
||||
links.forEach(function (link) {
|
||||
if (link.getAttribute('href') === hash) {
|
||||
link.classList.add('active');
|
||||
} else {
|
||||
link.classList.remove('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', setActiveFromHash);
|
||||
setActiveFromHash();
|
||||
})();
|
||||
Reference in New Issue
Block a user