{% extends "django_sample_components/pages/master_async.html" %} {% load async_tags %} {% block title %}Async Lazy Load{% endblock %} {% block content %}
This component loads server content only when it becomes visible in the viewport.
Scroll down to trigger each lazy-loading example. Delay is configured in milliseconds.
Uses the default internal URL (/async/lazy-load), default placeholder and no delay.
{% async_lazy_load %}Only customizes the waiting message.
{% async_lazy_load placeholder="Custom placeholder: waiting for visibility in viewport..." %}Forces a 1200ms response delay while keeping the default placeholder.
{% async_lazy_load delay_ms=1200 %}Uses an explicit internal URL and a 2500ms forced delay.
{% async_lazy_load url="/async/lazy-load/" placeholder="Preparing delayed content from internal URL..." delay_ms=2500 %}Loads Google via an internal proxy endpoint, avoiding browser CORS limitations.
{% async_lazy_load url="/async/lazy-load/external/?target_url=https://www.google.com" placeholder="Loading Google through internal proxy..." delay_ms=150 %}Combines a custom message with a 2500ms forced delay.
{% async_lazy_load placeholder="Preparing delayed content from server..." delay_ms=2500 %}Behaves like immediate loading, but with delay configured explicitly.
{% async_lazy_load placeholder="No artificial delay (delay_ms=0)." delay_ms=0 %}Loads the full counter component (+/- buttons and value) after a forced 2000ms delay.
{% async_lazy_load url="/async/counter/component/?initial_value=10&step=2&min_value=0&max_value=20" placeholder="Loading full counter component (2 seconds)..." delay_ms=2000 %}