summaryrefslogtreecommitdiff
path: root/actualités.html
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-11-24 00:53:00 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-11-24 00:53:00 +0100
commit1efc3082a3ec64e71ab4a6b5ed290d9473e77bc9 (patch)
tree4371a3e3a09f63c5bec6ac9047d6884a661e853d /actualités.html
parentb908b8959658676faff68677d4466d18a141b9f3 (diff)
downloadquatuorbellefeuille.com-1efc3082a3ec64e71ab4a6b5ed290d9473e77bc9.tar.xz
DTRT when loading a URL with an anchor
Diffstat (limited to 'actualités.html')
-rw-r--r--actualités.html9
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>