mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 10:02:38 +03:00
15 lines
462 B
JavaScript
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;
|
|
}
|
|
}); |