ProgressiveImageLoader has zero dependencies and ships as a single JavaScript file, so getting started requires nothing more than downloading one file, dropping it next to your HTML, and writing a handful of lines of JavaScript. Follow the steps below to go from a blank page to a fully working progressive image loader.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/1TSnakers/ProgressiveImageLoader/llms.txt
Use this file to discover all available pages before exploring further.
ProgressiveImageLoader fires one HTTP request per image variant in your
images
array. If you provide three image paths, the browser will make three separate
requests instead of one. Keep your low-quality variants small (a few kilobytes) so
the placeholder appears near-instantly, making the extra requests worthwhile.Download the library
Grab
progressive-image-loader.js from the GitHub repository.
Place it in the same directory as your HTML file, or in a js/ subfolder — wherever
you prefer to keep your scripts.Include the script in your HTML
Add a Place this tag in the
<script> tag that points to progressive-image-loader.js before your
own script block. No module bundler, no npm install — just a plain script tag.<body>, ideally just before your closing </body> tag so
it does not block the initial HTML parse.Add a container element
Create a ProgressiveImageLoader injects and replaces
<div> (or any block element) in your markup to act as the image
container. Give it an id so you can reference it easily from JavaScript.<img> elements inside this container
automatically — you do not need to add an <img> tag yourself.Instantiate ProgressiveImageLoader
After the script tag, add your own That’s the minimum required configuration. The library will immediately begin
loading
<script> block and call the constructor.
Pass in the container element and an images array ordered from least to
most quality.low-quality.png, display it, then load and fade in each subsequent
variant until high-quality.png is shown.(Optional) Customise with additional options
Fine-tune the experience using the optional constructor parameters:
| Option | Type | Default | Description |
|---|---|---|---|
width | number | — | Sets the rendered width of the image in pixels. |
height | number | — | Sets the rendered height of the image in pixels. |
fadeDuration | number | 500 | Duration of the fade transition between quality levels, in ms. |
disableCache | boolean | false | When true, appends a cache-busting query string to each URL. |
Complete working example
Here is a full, self-contained HTML page you can copy, save asindex.html, drop your
image variants alongside it, and open directly in a browser.
low-quality.png first (the smallest file), display it
immediately inside #image-container, then load and fade in medium-quality.png, and
finally high-quality.png — giving the user a visible image as early as possible while
the full-resolution version downloads in the background.
You can see this pattern running live at the official demo page.