feat: image load animation

This commit is contained in:
Rico van Zelst
2023-11-07 19:38:34 +01:00
parent b5342fcc9d
commit 790b8d280f
2 changed files with 15 additions and 3 deletions

View File

@@ -3,3 +3,14 @@ import "flowbite";
import "./icons";
import "./icons-brands";
import "./icons-duotone";
document.addEventListener("DOMContentLoaded", function () {
const images = document.querySelectorAll(".transition-opacity");
images.forEach((image) => {
image.onload = function () {
image.style.filter = "blur(0)";
image.style.opacity = "1";
};
});
});

View File

@@ -19,12 +19,13 @@
border border-stone-800 hover:border-orange-500/10 hover:shadow-orange-500/10">
<div
class="mx-4 mt-4 overflow-hidden h-52 rounded-2xl bg-clip-border border-2 border-orange-400/40">
<img @if($key < 8) loading="auto" @else loading="lazy" @endif
<img @if($key < 8) loading="eager" @else loading="lazy" @endif
src="//wsrv.nl/?url={{ $champion->getChampionImageAttribute() }}&w=400&output=webp&q=70"
class="object-cover w-full h-full"
class="object-cover w-full h-full transition-opacity filter blur-3 opacity-0"
alt="{{ $champion->name }} Splash Art"
/>
</div>
<div class="px-4 py-2">
<div class="flex items-center justify-between">
<p class="block text-base antialiased font-medium text-gray-100">