Add image enlargement

This commit is contained in:
2021-11-10 23:15:13 +01:00
parent a6d96dbdc2
commit 9ab6b65570
6 changed files with 126 additions and 9 deletions
@@ -0,0 +1,20 @@
window.addEventListener("load", () => {
document.querySelectorAll("figure.enlargable").forEach(node => {
node.addEventListener("click", () => {
console.log("Hey");
node.classList.toggle("enlarged")
})
})
const keyDown = (e) => {
if (e.keyCode !== 27) {
return
}
document.querySelectorAll("figure.enlarged").forEach(node => {
node.classList.remove("enlarged")
})
}
document.addEventListener('keydown', keyDown)
})