forked from Mirrors/gomuks
web/timeline: re-add loading=lazy for images
This commit is contained in:
parent
12f9031ab1
commit
229751a286
2 changed files with 9 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Add table
Reference in a new issue