1
0
Fork 0
forked from Mirrors/gomuks

web/timeline: re-add loading=lazy for images

This commit is contained in:
Tulir Asokan 2024-12-02 23:33:52 +02:00
parent 12f9031ab1
commit 229751a286
2 changed files with 9 additions and 0 deletions

View file

@ -224,6 +224,14 @@ div.media-container {
user-select: none;
border-radius: .25rem;
}
& + img {
/* In order loading=lazy to work, the image has to be visible,
so put it behind the placeholder instead of below */
position: absolute;
top: 0;
z-index: -1;
}
}
> a {

View file

@ -33,6 +33,7 @@ export const useMediaContent = (
const style = calculateMediaSize(content.info?.w, content.info?.h, containerSize)
return [<img
onLoad={onLoad}
loading="lazy"
style={style.media}
src={mediaURL}
alt={content.filename ?? content.body}