diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/garden.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/js/garden.js b/js/garden.js index be4e7e0..cb8a0ac 100644 --- a/js/garden.js +++ b/js/garden.js @@ -735,6 +735,17 @@ function loadIntensiveGarden() { refreshView(); }); refreshView(); + // Open/close sections of page. + document.querySelectorAll("section").forEach(section => { + const container = section.querySelector(".section-container"); + const header = section.querySelector("h2"); + header.classList.add("open"); + header.addEventListener("click", event => { + header.classList.remove(container.hidden ? "closed" : "open"); + container.hidden = !container.hidden; + header.classList.add(container.hidden ? "closed" : "open"); + }); + }); } window.addEventListener("load", loadIntensiveGarden); |