notes.ethanlennox.com

← Go Back

Notes

These are my notes.

Anything I think is worthy of keeping a note of will be kept here.

This is mostly a test post.

Cat

meow

const imgs = document.getElementsByTagName("img");
const imgsLength = imgs.length;
let enlargementContainer = document.getElementsByClassName("enlarge-container")[0];

for (let i = 0; i < imgsLength; ++i) {
    imgs[i].addEventListener("click", function() {
        enlargementContainer.children[0].src = imgs[i].src;
        enlargementContainer.style.display = "grid";
    });
}

enlargementContainer.addEventListener("click", function() {
    enlargementContainer.style.display = "none";
})
← Go Back