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

commit 20240914

This commit is contained in:
Thibaud
2024-09-14 18:03:24 +02:00
parent aea068a3d9
commit c02bc6fc47
9 changed files with 123 additions and 150 deletions

View File

@@ -3,10 +3,10 @@ const handleFooterIntersection = function (entries) {
// Loop through all the observed elements
entries.forEach(entry => { // Check if the element is intersecting the viewport
if (entry.isIntersecting) {
console.log("The footer is visible in the viewport");
msgConsole('IntersectionObserver','The footer is visible in the viewport');
if (typeof footerIsNowVisible === 'function') footerIsNowVisible(entry);
} else {
console.log("The footer is invisible in the viewport");
msgConsole('IntersectionObserver','The footer is invisible in the viewport');
if (typeof footerIsNowInvisible === 'function') footerIsNowInvisible(entry);
}
});

View File

@@ -1,7 +1,13 @@
// Create a function that will handle any intersection between some elements and the viewport.
const handleHeaderIntersection = function (entries) {
entries.forEach(entry => {
if (typeof headerIsVisible === 'function') headerIsNowVisible(entry.isIntersecting);
if (entry.isIntersecting) {
msgConsole('IntersectionObserver','The header is visible in the viewport');
if (typeof headerIsNowVisible === 'function') headerIsNowVisible(entry);
} else {
msgConsole('IntersectionObserver','The header is invisible in the viewport');
if (typeof headerIsNowInvisible === 'function') headerIsNowInvisible(entry);
}
});
}

View File

@@ -3,10 +3,10 @@ const handleSynthesisIntersection = function (entries) {
entries.forEach(entry => {
// Check if the element is intersecting the viewport
if (entry.isIntersecting) {
myLog("The synthesis is visible in the viewport");
msgConsole('IntersectionObserver',"The synthesis is visible in the viewport");
if (typeof synthesisTopIsNowVisible === 'function') synthesisIsNowVisible(entry);
} else {
myLog("The synthesis is invisible in the viewport");
msgConsole('IntersectionObserver',"The synthesis is invisible in the viewport");
if (typeof synthesisTopIsNowInvisible === 'function') synthesisIsNowInvisible(entry);
}
});