Add tooltips on homepage
This commit is contained in:
@@ -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");
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user