1
0
mirror of https://git.topisto.net/tibo/template.git synced 2026-03-31 19:29:10 +00:00

initialisation with SMETI code

This commit is contained in:
Thibaud
2024-09-13 17:26:06 +02:00
commit 2030381b45
118 changed files with 5779 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
// Create a function that will handle any intersection between some elements and the viewport.
const handleFooterIntersection = function (entries) {
// Loop through all the observed elements
for (let entry of entries) {
// Check if the element is intersecting the viewport
if (entry.isIntersecting) {
console.log("The footer is visible in the viewport");
if (typeof footerIsNowVisible === 'function') footerIsNowVisible(entry);
} else {
console.log("The footer is invisible in the viewport");
if (typeof footerIsNowInvisible === 'function') footerIsNowInvisible(entry);
}
}
}
const footer = document.querySelector("#footer");
if (footer) {
const footerObserver = new IntersectionObserver(handleFooterIntersection);
footerObserver.observe(footer);
}