You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Scripted/WEB/View/src/JS/Presentation.js

24 lines
690 B

const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
console.log(entry);
if (entry.isIntersecting) {
entry.target.classList.add("show");
} else {
entry.target.classList.remove("show");
}
});
});
const hiddenElements = document.querySelectorAll(".hidden");
hiddenElements.forEach((element) => observer.observe(element));
// Increase the top position of the element when scrolling down
const fox = document.querySelector(".moving-fox");
window.addEventListener("scroll", () => {
const scrollValue = window.scrollY - 600;
fox.style.top = `${scrollValue / 1.2}px`;
fox.style.opacity = `${window.scrollY / 500}`;
});