const foreground = document.querySelector("#foreground"); const releases = document.querySelectorAll(".index li a"); const title = document.querySelector(".meta.release .title"); const date = document.querySelector(".meta.release .date"); fetch("releases.json") .then((res) => res.json()) .then((data) => { for (const release of releases) { release.addEventListener("mouseenter", () => { foreground.src = `img/${release.dataset.bg}.png`; meta(data.releases[parseInt(release.dataset.bg)]); }); } }); const meta = function (release) { title.innerHTML = release.title; title.classList.remove("hidden"); date.innerHTML = release.date; date.classList.remove("hidden"); };