feat: optimize image hash
Some checks failed
Deploy to SFTP Server / build (push) Failing after 18m17s

This commit is contained in:
2024-04-06 22:38:56 +02:00
parent f86661bbba
commit 68431e6b9c
8 changed files with 850 additions and 648 deletions

View File

@@ -11,6 +11,8 @@
}, 600);
}
console.log("Thumbhash script loaded");
document.querySelectorAll("[data-thumbhash]").forEach((entry) => {
const parent = entry?.parentNode as HTMLPictureElement;
const img = entry as HTMLImageElement;
@@ -35,6 +37,10 @@
parent.style.background = `url(${dataURL})`;
parent.style.backgroundSize = "cover";
if (img.complete) {
return;
}
img.style.opacity = "0";
img.style.filter = "blur(5px)";
img.style.transition = "opacity 0.6s ease, filter 0.8s ease";