Lazy load card images

This commit is contained in:
Sam Carlton 2020-12-27 10:53:40 -06:00
parent 9019556009
commit 7cf5d488e5

View file

@ -8,13 +8,18 @@
<div class="video-card-container relative overflow-hidden bg-black"> <div class="video-card-container relative overflow-hidden bg-black">
<div class="video-card-image ratio-wrapper"> <div class="video-card-image ratio-wrapper">
<div class="relative overflow-hidden w-full pb-16/9"> <div class="relative overflow-hidden w-full pb-16/9">
<img <picture>
:srcset="thumbnailSrcset" <source
:sizes="thumbnailSizes" :sizes="thumbnailSizes"
:src="video.thumbnails.default.url" :data-srcset="thumbnailSrcset"
:alt="video.name" type="image/jpg"
class="absolute h-full w-full object-cover" >
> <img
:data-src="video.thumbnails.default.url"
:alt="video.name"
class="lazyload absolute h-full w-full object-cover"
>
</picture>
</div> </div>
</div> </div>
<div <div
@ -57,6 +62,8 @@
<script> <script>
import 'lazysizes'
// import { getVideoEndpoint } from '~/helpers/app-derived.js' // import { getVideoEndpoint } from '~/helpers/app-derived.js'
export default { export default {