INNER CODE UNIT · JavaScript
handleHash
asklokesh/loki-mode · blog/js/main.js:253
function handleHash() {
const hash = window.location.hash || '#home';
const targetId = hash.slice(1);
navLinks.forEach(link => {
if (link.getAttribute('href') === hash) {
link.classList.add('active');
} else {
link.classList.remove('active');
}
});
sections.forEach(section => {
if (section.id === targetId) {
section.classList.add('active');
} else {
section.classList.remove('active');
}