finds.dev← search

// the find

toddmotto/echo

★ 3,696 · JavaScript · updated Feb 2026

Lazy-loading images with data-* attributes

Echo.js is a minimal vanilla JavaScript library for lazy-loading images using data attributes. It predates the native `loading="lazy"` attribute and IntersectionObserver, which now handle this use case in every browser worth supporting. At 2KB it does what it says, but the problem it solves no longer requires a library.

Zero dependencies and a tiny footprint — if you're stuck supporting IE8, this is cleaner than rolling your own scroll listener. The offset API is granular enough to handle asymmetric preloading (different top/bottom/left/right thresholds). Background image lazy-loading via data-echo-background is a nice touch that native loading= doesn't cover. The debounce/throttle distinction is exposed explicitly rather than buried.

The scroll listener approach is the old way — IntersectionObserver is now baseline across all modern browsers and is more accurate, cheaper on the main thread, and handles iframes. Last meaningful update appears to be years old; the repo is effectively unmaintained. No support for srcset or picture elements, so responsive images are left out entirely. The placeholder approach (blank.gif) causes an extra HTTP request and flickers on slow connections compared to a transparent data URI or aspect-ratio CSS.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →