document.addEventListener("DOMContentLoaded", run); function run() { supportFireFox(); initializeClickHandler(); } /* Firefox seems to handle positioning after transform differently to webkit based browsers, therefore this function checks if the current userAgent is FF and sets the required property for bottom from 0 to 15vh */ function supportFireFox() { // console.log(navigator.userAgent); if (navigator.userAgent.includes("Firefox")) { // document.getElementById("exhibition").style.bottom = "15vh"; } } function initializeClickHandler() { document.addEventListener("click", (e) => { let overlay = document.getElementById("info-box"); let curr = e.target; console.log(curr); if (curr.className === "thumb") { handleThumb(overlay, curr); } else if (curr.id === "btn-close") { hideOverlay(overlay); } }); } function handleThumb(overlay, elem) { let imgName = elem.dataset.img; showOverlay(overlay, imgName); } function showOverlay(overlay, imgName) { let info = getInfoForImg(imgName); // \xD7 is the multiplication sign in hex overlay.children[0].innerHTML = `
Author: | ${info.author} |
---|---|
Size: | ${info.size} |
Tools: | ${info.tools} |
Date: | ${info.date} |
Price: | ${info.price} |
Description: | |
${info.desc} | |
Read more... |