mirror of
https://github.com/glanceapp/glance.git
synced 2024-12-15 01:22:37 +03:00
Revert setTimeout for images
Reduces instances of cached images fading in by giving the browser a bit more time to load them
This commit is contained in:
parent
eeda28a287
commit
0bbb4573b2
@ -161,20 +161,22 @@ function setupLazyImages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
afterContentReady(() => {
|
afterContentReady(() => {
|
||||||
for (let i = 0; i < images.length; i++) {
|
setTimeout(() => {
|
||||||
const image = images[i];
|
for (let i = 0; i < images.length; i++) {
|
||||||
|
const image = images[i];
|
||||||
|
|
||||||
if (image.complete) {
|
if (image.complete) {
|
||||||
image.classList.add("cached");
|
image.classList.add("cached");
|
||||||
setTimeout(() => imageFinishedTransition(image), 1);
|
setTimeout(() => imageFinishedTransition(image), 1);
|
||||||
} else {
|
} else {
|
||||||
// TODO: also handle error event
|
// TODO: also handle error event
|
||||||
image.addEventListener("load", () => {
|
image.addEventListener("load", () => {
|
||||||
image.classList.add("loaded");
|
image.classList.add("loaded");
|
||||||
setTimeout(() => imageFinishedTransition(image), 400);
|
setTimeout(() => imageFinishedTransition(image), 400);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,11 +349,11 @@ async function setupPage() {
|
|||||||
pageContentElement.innerHTML = pageContent;
|
pageContentElement.innerHTML = pageContent;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setupLazyImages();
|
|
||||||
setupCarousels();
|
setupCarousels();
|
||||||
setupCollapsibleLists();
|
setupCollapsibleLists();
|
||||||
setupCollapsibleGrids();
|
setupCollapsibleGrids();
|
||||||
setupDynamicRelativeTime();
|
setupDynamicRelativeTime();
|
||||||
|
setupLazyImages();
|
||||||
} finally {
|
} finally {
|
||||||
pageElement.classList.add("content-ready");
|
pageElement.classList.add("content-ready");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user