Commit a416c5a 1 parent 8714baf commit a416c5a Copy full SHA for a416c5a
File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export interface GalleryImage {
7
7
src: string
8
8
alt: string
9
9
aspectRatio: number
10
+ lazy: boolean
10
11
}
11
12
</script >
12
13
@@ -29,12 +30,12 @@ export interface GalleryImage {
29
30
<img
30
31
:src =" image.src"
31
32
:alt =" image.alt"
32
- loading =" lazy"
33
+ : loading =" image. lazy ? 'lazy' : 'eager' "
33
34
decoding =" async"
34
35
oncontextmenu =" return false"
35
36
ondragstart =" return false"
36
37
on-touchstart =" return false"
37
- class =" w-full shadow-2xl"
38
+ class =" w-full select-none shadow-2xl"
38
39
>
39
40
</div >
40
41
</MasonryWall >
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function getAltFromFilename(filename: string): string {
17
17
return filename .substring (start , end ).replace (/ -/ g , ' ' )
18
18
}
19
19
20
- const processedImages = rawImages .map (async (rawImage ) => {
20
+ const processedImages = rawImages .map (async (rawImage , index ) => {
21
21
const alt = getAltFromFilename (rawImage .src )
22
22
const {
23
23
src,
@@ -27,6 +27,7 @@ const processedImages = rawImages.map(async (rawImage) => {
27
27
src ,
28
28
alt ,
29
29
aspectRatio: width / height ,
30
+ lazy: index >= 10 ,
30
31
}
31
32
})
32
33
You can’t perform that action at this time.
0 commit comments