summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2022-01-22 18:11:06 -0500
committerDavid Thompson <dthompson@vistahigherlearning.com>2022-01-22 18:11:06 -0500
commitd445a346dc578d6078191931064fc915c1bad78b (patch)
tree4a5a1ade4abb99a60326eae248a7228c3096d5a2 /js
parente258aaa656e9dcc3b61341ddf00e1ba7815b23a7 (diff)
Make it so you can open/close sections of the page.
Diffstat (limited to 'js')
-rw-r--r--js/garden.js11
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);