[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/case/ - Case Studies

Success stories, client work & project breakdowns
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1792083919564.jpg (139.9 KB, 1024x1024, img_1792083911449_mcpynq9n.jpg)ImgOps Exif Google Yandex

cd1da No.2322

had a client freak out because their landing page was heavy as hell on mobile. i ended up just using this simple intersection observer setup to swap the low res placeholder with the real thing only when it's actually in view. don't skip this if you're working with unoptimized photography or high-density retina assets.
const observer = new IntersectionObserver((entries) => {entries.forEach(entry => {if (entry.isIntersecting) {entry.target.src = entry.target.dataset.src;observer.unobserve(entry.target);}});});

it works fine for most standard grids but does it mess with your lcp scores on anything?


[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]