remove ineffective optimization (hide !isIntersecting images)

This commit is contained in:
Tomáš Mládek 2021-01-11 19:35:04 +01:00
parent 452cb267fb
commit 70759c7a69

View file

@ -60,7 +60,6 @@ export default defineComponent({
entries.forEach((entry) => { entries.forEach((entry) => {
const element = entry.target as HTMLImageElement; const element = entry.target as HTMLImageElement;
if (entry.isIntersecting) { if (entry.isIntersecting) {
element.classList.add("visible");
if (!element.src) { if (!element.src) {
element.src = element.dataset.src!; element.src = element.dataset.src!;
if (element.dataset.direction == "left" || element.dataset.direction == "right") { if (element.dataset.direction == "left" || element.dataset.direction == "right") {
@ -72,8 +71,6 @@ export default defineComponent({
element.classList.add("loaded"); element.classList.add("loaded");
}; };
} }
} else {
element.classList.remove("visible");
} }
}); });
}); });
@ -113,14 +110,10 @@ export interface VideoScrollDef {
image-rendering: optimizeSpeed; image-rendering: optimizeSpeed;
opacity: 0; opacity: 0;
transition: opacity .5s; transition: opacity .5s;
visibility: hidden;
} }
.loaded { .loaded {
opacity: 1 !important; opacity: 1 !important;
} }
.visible {
visibility: visible !important;
}
</style> </style>