1// загÑÑзка изобÑажений ÑолÑко Ñогда, когда они Ð½Ð°Ñ Ð¾Ð´ÑÑÑÑ Ð² облаÑÑи видимоÑÑи 2const lazyImages = document.querySelectorAll('.banner_item.lazy'); 3 4const options = { 5 root: null, 6 rootMargin: '0px', 7 threshold: 0.1, 8}; 9 10const lazyLoad = (image) => { 11 const src = image.dataset.src; 12 if (src) { 13 image.src = src; 14 image.classList.remove('lazy'); 15 } 16}; 17 18const imageObserver = new IntersectionObserver((entries, observer) => { 19 entries.forEach(entry => { 20 if (entry.isIntersecting) { 21 lazyLoad(entry.target); 22 observer.unobserve(entry.target); 23 } 24 }); 25}, options); 26 27lazyImages.forEach(image => { 28 imageObserver.observe(image); 29});
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.