|
|
|
@ -1,17 +1,20 @@ |
|
|
|
const synthesisTopObserver = new IntersectionObserver(entries => {
|
|
|
|
// Create a function that will handle any intersection between some elements and the viewport.
|
|
|
|
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");
|
|
|
|
if (typeof synthesisTopIsNowVisible === 'function') synthesis
Top
IsNowVisible(entry);
|
|
|
|
} else {
|
|
|
|
myLog("The synthesis is invisible in the viewport");
|
|
|
|
if (typeof synthesisTopIsNowInvisible === 'function') synthesis
Top
IsNowInvisible(entry);
|
|
|
|
}
|
|
|
|
if (entry.isIntersecting) {
|
|
|
|
myLog("The synthesis is visible in the viewport");
|
|
|
|
if (typeof synthesisTopIsNowVisible === 'function') synthesis
IsNowVisible(entry);
|
|
|
|
} else {
|
|
|
|
myLog("The synthesis is invisible in the viewport");
|
|
|
|
if (typeof synthesisTopIsNowInvisible === 'function') synthesis
IsNowInvisible(entry);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const synthesis_top = document.querySelector("#synthesis_top");
|
|
|
|
if (synthesis_top) synthesisTopObserver.observe(synthesis_top);
|
|
|
|
else myLog('No #synthesis_top to obseve');
|
|
|
|
const section_synthesis = document.querySelector("#synthesis");
|
|
|
|
if (section_synthesis) {
|
|
|
|
const synthesisObserver = new IntersectionObserver(handleSynthesisIntersection);
|
|
|
|
if (synthesisObserver) synthesisObserver.observe(section_synthesis);
|
|
|
|
} else myLog('No #synthesis to observe');
|
|
|
|
|