Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

19 рядки
938 B

// Create a function that will handle any intersection between some elements and the viewport.
const handleFooterIntersection = function (entries) {
  // Loop through all the observed elements
  entries.forEach(entry => {      // Check if the element is intersecting the viewport
      if (entry.isIntersecting) {
        msgConsole('IntersectionObserver','The footer is visible in the viewport');
        if (typeof footerIsNowVisible === 'function') footerIsNowVisible(entry);
      } else {
        msgConsole('IntersectionObserver','The footer is invisible in the viewport');
        if (typeof footerIsNowInvisible === 'function') footerIsNowInvisible(entry);
      }
  });
}
const section_footer = document.querySelector("#footer");
if (section_footer) {
  const footerObserver = new IntersectionObserver(handleFooterIntersection);
  if (footerObserver) footerObserver.observe(section_footer);
} else myLog('No footer to observe');