1window.sections = [...document.querySelectorAll('.section')]; 2window.lastScrollTop = window.pageYOffset; 3 4document.body.style.background = window.sections[0].getAttribute('data-bg'); 5 6window.addEventListener('scroll', onScroll); 7 8function onScroll() { 9 const scrollTop = window.pageYOffset; 10 11 const section = window.sections 12 .map(section => { 13 const el = section; 14 const rect = el.getBoundingClientRect(); 15 return {el, rect}; 16 }) 17 .find(section => section.rect.bottom >= (window.innerHeight * 0.5)); 18 document.body.style.background = section.el.getAttribute('data-bg'); 19}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.