标签:each data abs bsp let 加载 trie 懒加载 set
const io = new IntersectionObserver(callback); let imgs = document.querySelectorAll(‘[data-src]‘); function callback(entries){ entries.forEach((item) => { if(item.isIntersecting){ item.target.src = item.target.dataset.src io.unobserve(item.target) } }) } imgs.forEach((item)=>{ io.observe(item) })
标签:each data abs bsp let 加载 trie 懒加载 set
原文地址:https://www.cnblogs.com/vicky24k/p/12093278.html