tilde-raf/script.js

23 lines
709 B
JavaScript
Raw Permalink Normal View History

const currentYear = new Date().getFullYear();
const footerText =
currentYear === 2024
? "© 2024 NotAShelf"
: `© 2024-${currentYear} NotAShelf`;
document.getElementById("footer-text").textContent = footerText;
const tooltip = document.querySelector(".tooltip");
const hoverItems = document.querySelectorAll(".hover-item");
hoverItems.forEach((item) => {
item.addEventListener("mouseenter", (e) => {
tooltip.innerText = e.target.dataset.content;
tooltip.style.display = "block";
tooltip.style.left = e.pageX + "px";
tooltip.style.top = e.pageY - tooltip.offsetHeight - 35 + "px";
});
item.addEventListener("mouseleave", () => {
tooltip.style.display = "none";
});
});