You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
695 B
JavaScript

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");
};