Add tooltips on homepage

This commit is contained in:
Vojtěch Káně
2021-09-24 01:25:04 +02:00
parent 46ccc879da
commit 08c6afeecd
3 changed files with 91 additions and 1 deletions

View File

@@ -4,4 +4,17 @@ document.addEventListener("DOMContentLoaded", () => {
const code = joinForm.querySelector("input[name=\"code\"]").value;
joinForm.action = "/play/" + encodeURIComponent(code);
});
document.body.addEventListener("click", () => {
for (const help of document.querySelectorAll(".message.show")) {
help.classList.remove("show");
}
});
const helps = document.getElementsByClassName("help");
for (const help of helps) {
help.addEventListener("click", (e) => {
e.stopPropagation();
console.log(e.target);
e.target.parentElement.querySelector(".message").classList.toggle("show");
})
}
});