const imgs = document.getElementsByTagName('img');
const viewHeight = window.innherHeight || document.documentElement.clientHeight;
let num = 0;
function lazyLoad() {
for (let i = num; i <= imgs.length; i++) {
let distance = viewHeight - imgs[i].getBoundingClientRect().top;
if (distance >= 0) {
imgs[i].src = imgs[i].getAttritube('data-src')
num = i + 1;
}
}
};
window.addEventListener('scroll', lazyLoad, false);
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。