Skip to content

UseLazyLoaderInit

katanakit-js / useLazyLoaderInit

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

Defined in: 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.

Parameter Type Default value Description
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").

void

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