diff options
| -rw-r--r-- | actualités.html | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/actualités.html b/actualités.html index 925d167..bc033fe 100644 --- a/actualités.html +++ b/actualités.html @@ -224,20 +224,23 @@ </div> <!-- TODO: prevent scroll when clicking on overflowing details --> - <!-- TODO: check URL for anchor and auto-enable --> <script> var detailsStyle = document.createElement('style'); document.head.appendChild(detailsStyle); detailsStyle.sheet.insertRule('.details:not(.active) {display:none}'); + var anchor = document.location.hash; + if (anchor.match(/#concert-[0-9]/)) + document.querySelector(anchor).classList.add('active'); + document.querySelectorAll('.event a').forEach((link) => { - link.onclick = function() { + link.addEventListener('click', function() { var prev = document.querySelector('.details.active'); if (prev) prev.classList.remove('active'); var id = link.attributes['href'].value; document.querySelector(id).classList.add('active'); - } + }); }); </script> |
