← All examples

Lazy reveal

This fragment is not requested on page load. Scroll down until the dashed placeholder enters the viewport; revealed then fetches it once.

Scroll down ↓
Loading section…

Placeholder — not loaded yet.

How it works

  1. revealed creates an IntersectionObserver and watches the trigger element.
  2. When the element intersects the viewport, Minu sends the request and disconnects the observer.
  3. The returned HTML replaces the contents of #lazy-content.
  4. intersect works the same way but stays connected and requests on every entry.
  5. Browsers without IntersectionObserver fall back to loading immediately.
<div minu-get="/demo/lazy"
     minu-trigger="revealed"
     minu-target="#lazy-content">
    <div id="lazy-content"></div>
</div>

Use revealed for below-the-fold sections and images. Use intersect when content should refresh every time it becomes visible.