Skip to content

Commit

Permalink
Resolve collapsible nested callouts (#80)
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
12-VidE authored Feb 18, 2023
1 parent 4d5458c commit c1891a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/site/_includes/components/calloutScript.njk
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -38,4 +38,4 @@
});
});
});
</script>
</script>

0 comments on commit c1891a3

Please sign in to comment.