mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-04-24 15:37:12 -05:00
13 lines
333 B
JavaScript
13 lines
333 B
JavaScript
// I stole this code.
|
|
for(let el of document.querySelectorAll("details")) {
|
|
el.addEventListener("click", evt => {
|
|
// Close detail elements if clicking elsewhere
|
|
let path = evt.path || [];
|
|
document.querySelectorAll("details[open]").forEach(el => {
|
|
if (!path.includes(el)) {
|
|
el.removeAttribute("open");
|
|
}
|
|
});
|
|
});
|
|
}
|