play around with image loading
This commit is contained in:
parent
d4db8430e4
commit
d2a02fcf34
@ -246,12 +246,15 @@ document.querySelectorAll("[data-thumb]").forEach((entry) => {
|
|||||||
entry.style.backgroundSize = "cover";
|
entry.style.backgroundSize = "cover";
|
||||||
|
|
||||||
const child = entry.querySelector("img[data-thumb-img]");
|
const child = entry.querySelector("img[data-thumb-img]");
|
||||||
const isLoaded = child && child.complete && child.naturalHeight !== 0;
|
setTimeout(() => {
|
||||||
if (child && !isLoaded) {
|
const isLoaded = child && child.complete && child.naturalHeight !== 0;
|
||||||
child.style.opacity = 0;
|
console.log(isLoaded, child.getAttribute("src"));
|
||||||
child.addEventListener("load", () => {
|
if (child && !isLoaded) {
|
||||||
child.style.transition = "opacity 0.3s ease";
|
child.style.opacity = 0;
|
||||||
child.style.opacity = 1;
|
child.addEventListener("load", () => {
|
||||||
});
|
child.style.transition = "opacity 0.3s ease";
|
||||||
}
|
child.style.opacity = 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 50);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user