whatisgithub

What is echo?

toddmotto/echo — explained in plain English

Analysis updated 2026-07-03

3,698JavaScriptAudience · developerComplexity · 1/5LicenseSetup · easy

In one sentence

A 2KB JavaScript library that lazy-loads images as the user scrolls, keeping initial page loads fast by only downloading images when they are about to come into view.

Mindmap

mindmap
  root((echo.js))
    What it does
      Lazy-load images
      Scroll-triggered loading
      Background image support
    Config options
      offset for preloading
      throttle scroll checks
      unload out-of-view images
      callback on load
    Tech
      Vanilla JavaScript
      2KB size
      IE8 compatible
    Use cases
      Image-heavy pages
      Long scrolling feeds
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Speed up a page with many images by loading them only when the user scrolls close to them instead of all at once.

USE CASE 2

Add lazy-loading to CSS background images by using the data-echo-background attribute instead of inline src.

USE CASE 3

Trigger a fade-in CSS animation each time a lazy image loads using the callback option.

USE CASE 4

Free up memory on a very long page by unloading images that scroll far back out of view using the unload option.

What is it built with?

JavaScript

How does it compare?

toddmotto/echotechxuexi/techxuexi-jswellcaffeinated/physicsjs
Stars3,6983,6983,699
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity1/51/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Drop in the 2KB script, swap src for data-echo on your images, and call Echo.init, no build step required.

MIT license, use freely in personal or commercial projects, just keep the copyright notice.

So what is it?

Echo.js is a small JavaScript library, around 2 kilobytes, that handles lazy-loading of images on a web page. Lazy-loading means images are not downloaded when the page first loads but are instead loaded only when the user scrolls close to them. This keeps initial page loads fast, especially on pages with many images. The setup is minimal. Instead of putting the real image URL in a standard src attribute, you put a placeholder image there and put the real URL in a custom data-echo attribute. Echo.js watches the page as the user scrolls and swaps in the real image when that element comes into view. For background images applied via CSS, a separate data-echo-background attribute works the same way. Configuration is done through an init function with a handful of options. The offset setting controls how far outside the visible area an image should start loading, so you can preload images slightly before they scroll into view. A throttle option (250 milliseconds by default) controls how often the scroll position is checked so the page does not slow down from too many checks during fast scrolling. There is also an unload option that removes images from memory once they scroll back out of view, which can help on very long pages. A callback function lets you run custom code each time an image loads or unloads, for example to add a CSS class for a fade-in animation. Echo.js also exposes a render method for situations where images need to be checked without any scrolling happening, such as when a filter on a page rearranges content. The library is licensed under MIT and works in browsers as old as Internet Explorer 8.

Copy-paste prompts

Prompt 1
Using toddmotto/echo.js, show me the minimum HTML and JavaScript setup to lazy-load images on a page so they only download when scrolled into view.
Prompt 2
How do I add a fade-in CSS animation every time echo.js loads an image? Show me the callback setup.
Prompt 3
I have a page where content gets rearranged by a filter without scrolling. How do I tell echo.js to re-check which images should load using the render method?
Prompt 4
What is the offset option in echo.js and how do I set it to start loading images 200 pixels before they scroll into view?
Prompt 5
How do I use echo.js to lazy-load CSS background images instead of inline img tags?

Frequently asked questions

What is echo?

A 2KB JavaScript library that lazy-loads images as the user scrolls, keeping initial page loads fast by only downloading images when they are about to come into view.

What language is echo written in?

Mainly JavaScript. The stack also includes JavaScript.

What license does echo use?

MIT license, use freely in personal or commercial projects, just keep the copyright notice.

How hard is echo to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is echo for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.