Skip to content

Commit 6c7b40a

Browse files
committed
Add feedback message to Find lazily ladded images above the fold
1 parent ab60166 commit 6c7b40a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pages/Loading/Find-Above-The-Fold-Lazy-Loades-Images.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ List all images that have `loading="lazy"` or `[data-src]` _(lazy loading via JS
55
#### Snippet
66

77
```js copy
8+
// List all lazily loaded images above the fold
9+
// https://webperf-snippets.nucliweb.net
810
function findATFLazyLoadedImages() {
911
const lazy = document.querySelectorAll('[loading="lazy"], [data-src]');
1012
let lazyImages = [];
@@ -14,7 +16,7 @@ function findATFLazyLoadedImages() {
1416
lazyImages = [...lazyImages, tag];
1517
}
1618
});
17-
return lazyImages.length > 0 ? lazyImages : false;
19+
return lazyImages.length > 0 ? lazyImages : "Good job, the site does not have any lazily loaded images.";
1820
}
1921

2022
console.log(findATFLazyLoadedImages());

0 commit comments

Comments
 (0)