EveryDocumentation 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 instance is configured through a single options object passed to the constructor. Two options are required — container and images — while the remaining four are optional with sensible defaults baked into the library. Understanding each option lets you tune both the visual behaviour and network characteristics to match your use case.
Constructor signature
Options reference
The DOM element that will contain the progressive image. Pass a direct reference to the element — for example
document.getElementById('image-container'). The loader appends a positioned wrapper <div> with two stacked <img> elements inside this container.The container does not need any special CSS; the loader sets all required positioning styles on the inner wrapper automatically.An array of image path strings ordered from least quality to most quality. The loader requests each image in array order and replaces the displayed image whenever a higher-index (better) image finishes loading.Place your most-degraded (blurriest / lowest-resolution) image at index
0 and your full-quality image last. At least two images are recommended; a single-entry array defeats the purpose of progressive loading.Display width of the image in pixels. The loader sets this as the
width CSS value on the inner wrapper element. Both stacked <img> elements stretch to fill this wrapper using width: 100%.If you omit this option, the image is displayed at 600 px wide regardless of the source image’s natural dimensions.Display height of the image in pixels. Works identically to
width — applied as a CSS height on the inner wrapper. Images are fitted inside the box using object-fit: contain, so your original aspect ratio is always preserved without cropping.If you omit this option, the wrapper defaults to 600 px tall. When combined with object-fit: contain, a mismatched aspect ratio will simply leave empty space on two sides rather than distorting the image.Duration of the cross-fade transition between quality levels, in milliseconds. The library applies this value as the
transition duration on each <img> element’s opacity property.Higher values produce a slower, more visible blend; 0 makes each quality upgrade appear instantaneously.When
true, appends a timestamp query parameter (?t=<unix-ms>) to every image URL before fetching. This forces the browser to bypass its HTTP cache and always download a fresh copy of each image.Set this to true during active development when you are frequently regenerating test images and need to guarantee the latest version is displayed.Full configuration example
The snippet below mirrors the structure used in the official README and shows every option in one place.Enabling
disableCache: true means the browser downloads every image in the images array fresh on every page load, regardless of whether a cached version is available. For a 9-image sequence this can multiply your bandwidth use significantly — keep it set to false (the default) in production.