carlwgeorge / centos / centos.org

Forked from centos/centos.org 3 years ago
Clone
401d07
window.addEventListener("DOMContentLoaded",()=>{const e=new IntersectionObserver(e=>{e.forEach(e=>{const t=e.target.getAttribute("id");e.intersectionRatio>0?document.querySelector(`nav li a[href="#${t}"]`).parentElement.classList.add("active"):document.querySelector(`nav li a[href="#${t}"]`).parentElement.classList.remove("active")})});document.querySelectorAll("h2[id]").forEach(t=>{e.observe(t)})});