您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

15 行
535 B

// 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);
  });
}
const section_header = document.querySelector("header");
if (section_header) {
  const headerObserver = new IntersectionObserver(handleHeaderIntersection);
  if (headerObserver) headerObserver.observe(section_header);
} else myLog('No header to observe');