fix: error when images load too fast
This commit is contained in:
parent
e666664924
commit
0f3f64d118
@ -246,7 +246,8 @@ document.querySelectorAll("[data-thumb]").forEach((entry) => {
|
||||
entry.style.backgroundSize = "cover";
|
||||
|
||||
const child = entry.querySelector("img[data-thumb-img]");
|
||||
if (child && !child.complete) {
|
||||
const isLoaded = child && child.complete && child.naturalHeight !== 0;
|
||||
if (child && !isLoaded) {
|
||||
child.style.opacity = 0;
|
||||
child.addEventListener("load", () => {
|
||||
child.style.transition = "opacity 0.3s ease";
|
||||
|
Loading…
x
Reference in New Issue
Block a user