smoothly show loading images
This commit is contained in:
parent
6e07542ace
commit
5732daf32e
1 changed files with 9 additions and 0 deletions
|
@ -39,6 +39,9 @@ export default defineComponent({
|
||||||
if (entry.isIntersecting) {
|
if (entry.isIntersecting) {
|
||||||
const element = entry.target as HTMLImageElement;
|
const element = entry.target as HTMLImageElement;
|
||||||
element.src = element.dataset.src!;
|
element.src = element.dataset.src!;
|
||||||
|
element.onload = () => {
|
||||||
|
element.classList.add("visible");
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, {rootMargin: "100px"});
|
}, {rootMargin: "100px"});
|
||||||
|
@ -85,5 +88,11 @@ function getMeta(url: string): Promise<HTMLImageElement> {
|
||||||
.video-scroll img {
|
.video-scroll img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
image-rendering: optimizeSpeed;
|
image-rendering: optimizeSpeed;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity .5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visible {
|
||||||
|
opacity: 1 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue