From c1891a3ee36b0b25f7dd6d67500b8bd7664fbc82 Mon Sep 17 00:00:00 2001 From: 12-VidE <76615801+12-VidE@users.noreply.github.com> Date: Sat, 18 Feb 2023 19:40:50 +0100 Subject: [PATCH] Resolve collapsible nested callouts (#80) Previously: When there are nested collapsible callouts, if you want to open a child one, by clicking on it, the parent one will close. You would have to re-open the parent one to see the now-open child callout. Now: To open and close a collapsible callout, you have to click on the "callout-title" div; resolve the problem with nested one. Live preview: https://voidblueprint.vercel.app/void-blueprint/physics/classic-physics/electro-magnetism/charge-conservation-law/ --- src/site/_includes/components/calloutScript.njk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/site/_includes/components/calloutScript.njk b/src/site/_includes/components/calloutScript.njk index 038062745..21f6213c1 100644 --- a/src/site/_includes/components/calloutScript.njk +++ b/src/site/_includes/components/calloutScript.njk @@ -29,7 +29,7 @@ // Collapse callouts Array.from(document.querySelectorAll(".callout.is-collapsible")).forEach((elem) => { - elem.addEventListener("click", (event) => { + elem.querySelector('.callout-title').addEventListener("click", (event) => { if (elem.classList.contains("is-collapsed")) { elem.classList.remove("is-collapsed"); } else { @@ -38,4 +38,4 @@ }); }); }); - \ No newline at end of file +