UNPKG

1.51 kBTypeScriptView Raw
1import Swiper from '../swiper-class';
2
3export interface LazyMethods {
4 /**
5 * Load/update lazy images based on current slider state (position)
6 */
7 load(): void;
8
9 /**
10 * Force to load lazy images in slide by specified index
11 * @param number index number of slide to load lazy images in
12 */
13 loadInSlide(index: number): void;
14}
15
16export interface LazyEvents {
17 /**
18 * Event will be fired in the beginning of lazy loading of image
19 */
20 lazyImageLoad: (swiper: Swiper, slideEl: HTMLElement, imageEl: HTMLElement) => void;
21 /**
22 * Event will be fired when lazy loading image will be loaded
23 */
24 lazyImageReady: (swiper: Swiper, slideEl: HTMLElement, imageEl: HTMLElement) => void;
25}
26
27export interface LazyOptions {
28 /** Set to "true" to enable lazy loading for the closest slides images (for previous and next slide images) */
29 loadPrevNext?: boolean;
30 /** Amount of next/prev slides to preload lazy images in. Can't be less than slidesPerView */
31 loadPrevNextAmount?: number;
32 /** By default, Swiper will load lazy images after transition to this slide, so you may enable this parameter if you need it to start loading of new image in the beginning of transition */
33 loadOnTransitionStart?: boolean;
34 /** CSS class name of lazy element */
35 elementClass?: string;
36 /** CSS class name of lazy loading element */
37 loadingClass?: string;
38 /** CSS class name of lazy loaded element */
39 loadedClass?: string;
40 /** CSS class name of lazy preloader */
41 preloaderClass?: string;
42}