Use readystatechange for active links

This commit is contained in:
Nicolò P 2021-09-02 12:32:29 +02:00
parent c9127e3384
commit 6f945e72f3
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@
<div class="column col-sm-2 show-sm text-right">
<i class="icon icon-menu icon-2x"></i>
</div>
<div class="hide-sm column col-lg-5 col-sm-12 col-md-120 col-md-10 nav-light nav-menu" id="links">
<div class="hide-sm column col-lg-5 col-sm-12 col-md-10 nav-menu" id="links">
<a href="index.html" title="Torna alla home page">Home</a>
<a href="progetto.html" title="Vai alla descrizione del progetto">Il progetto</a>
<a href="itinerario.html" title="Vai all'itinerario">L'itinerario</a>

View File

@ -39,7 +39,7 @@ if (homeRE.test(window.location.href)) {
* Apply active class to selected link...
* @todo Inefficient!!
*/
window.addEventListener('focus', () => {
document.addEventListener('readystatechange', () => {
let navlinks = Array.from(document.querySelectorAll('#links a'));
navlinks.forEach(element => {