feat: optimize image hash
Some checks failed
Deploy to SFTP Server / build (push) Failing after 18m17s
Some checks failed
Deploy to SFTP Server / build (push) Failing after 18m17s
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user