From a7e339768797f1f809b041bb5af903b58bc82830 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 19 Aug 2022 20:25:57 -0500 Subject: Add script.js and a toggle button --- script.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 script.js (limited to 'script.js') diff --git a/script.js b/script.js new file mode 100644 index 0000000..01458c9 --- /dev/null +++ b/script.js @@ -0,0 +1,11 @@ +// Toggle all
on the page (thanks elioat!) + +const toggleDetails = () => { + document.body.querySelectorAll("details").forEach((e) => { + if (!e.classList.contains("info")) { + e.hasAttribute("open") + ? e.removeAttribute("open") + : e.setAttribute("open", true); + } + }); +}; -- cgit 1.4.1-21-gabe81