Lazy load media

This commit is contained in:
schmelczerandras 2020-11-19 13:49:15 +01:00
parent c09f576cc1
commit 848ccf0ff3
3 changed files with 5 additions and 1 deletions

View file

@ -16,8 +16,11 @@ export const generate = ({
}): html => `
${container ? `<div class="figure-container">` : ''}
<img tabindex="0"
loading="lazy"
srcset="${image.srcSet}"
sizes="${sizes}"
width="${image.width}"
height="${image.height}"
src="${last(image.images)?.path}"
alt="${alt}"
/>

View file

@ -16,7 +16,7 @@ export const generate = ({
container: boolean;
}): html => `
${container ? `<div class="figure-container">` : ''}
<video ${options} ${poster ? `poster="${poster}` : ''}" >
<video loading="lazy" ${options} ${poster ? `poster="${poster}` : ''}" >
<source src="${webm}" type="video/webm"/>
<source src="${mp4}" type="video/mp4"/>
</video>

View file

@ -63,6 +63,7 @@ html {
position: relative;
z-index: -2;
width: 100%;
height: auto;
}
}