jrd / centos / centos.org

Forked from centos/centos.org 4 years ago
Clone
Blob Blame History Raw
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)})});