<a href="example">Example</a>
window.addEventListener("hashchange", (e) => {
document.querySelectorAll('.lang > a').forEach(el = el.classList.remove('active'));
switch(location.hash) {
case '#en': document.getElementById('lang-en').classList.add('active'); break;
case '#fr': document.getElementById('lang-fr').classList.add('active'); break;
default: break;
};
}, false);