Saltar al contenido principal

Function: useLazyLoaderInit()

useLazyLoaderInit(key?, selector?, rootMargin?): void

Defined in: src/infrastructure/observer/observer.service.ts:227

Initializes lazy loading for images using IntersectionObserver. Elements matching the selector must have a data-src attribute with the real image URL.

Parameters

key?

string = "default"

A unique identifier for this lazy-loader instance (default: "default").

selector?

string = "img[data-src]"

CSS selector for lazy-loadable images (default: "img[data-src]").

rootMargin?

string = "200px"

IntersectionObserver root margin (default: "200px").

Returns

void

Example

useLazyLoaderInit("gallery", "img[data-src]", "300px");