summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-11-23 00:03:57 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-11-23 00:03:57 +0100
commitc7d0c9d90c7981878e5dc7f163fb41f350c5f45e (patch)
tree1bed175579d6b2c0d198fb0760ddd8811bfa68bf
parent89d7345d98640482f1f925b06a8238f3b1355ba1 (diff)
downloadquatuorbellefeuille.com-c7d0c9d90c7981878e5dc7f163fb41f350c5f45e.tar.xz
Hide and show details on demand
Don't write display:none into regular stylesheets, otherwise people who disable JS will be screwed.
-rw-r--r--actualités.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/actualités.html b/actualités.html
index 937b83e..136f089 100644
--- a/actualités.html
+++ b/actualités.html
@@ -223,6 +223,24 @@
</div>
</div>
+ <!-- TODO: scroll list and details independently -->
+ <!-- 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}');
+
+ document.querySelectorAll('.event a').forEach((link) => {
+ link.onclick = 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>
+
</main>
<footer class="social">