roc/www/public/site.js
2022-12-08 22:05:07 -05:00

15 lines
462 B
JavaScript

const tutorialTocToggle = document.querySelector("#tutorial-toc-toggle");
document.querySelectorAll("#tutorial-toc li a").forEach((elem) => {
// Clicking any of the ToC links closes the ToC
elem.addEventListener("click", (event) => {
tutorialTocToggle.checked = false;
})
});
document.addEventListener("keydown", (event) => {
// Escape closes the ToC
if (event.key == "Escape") {
tutorialTocToggle.checked = false;
}
});