diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-11-23 00:03:57 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-11-23 00:03:57 +0100 |
| commit | c7d0c9d90c7981878e5dc7f163fb41f350c5f45e (patch) | |
| tree | 1bed175579d6b2c0d198fb0760ddd8811bfa68bf /actualités.html | |
| parent | 89d7345d98640482f1f925b06a8238f3b1355ba1 (diff) | |
| download | quatuorbellefeuille.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.
Diffstat (limited to 'actualités.html')
| -rw-r--r-- | actualités.html | 18 |
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"> |
