From 6ce04822bc177134bf2fdd51d604bab308dce290 Mon Sep 17 00:00:00 2001 From: RifatCse Date: Wed, 12 Oct 2022 17:50:46 +0600 Subject: [PATCH 1/3] Update LazyLoad.js --- examples/LazyLoad.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/LazyLoad.js b/examples/LazyLoad.js index d5ecfeb74..c124cc92d 100644 --- a/examples/LazyLoad.js +++ b/examples/LazyLoad.js @@ -6,7 +6,8 @@ export default class LazyLoad extends Component { render() { const settings = { dots: true, - lazyLoad: true, + lazyLoad: 'ondemand', + ondemandSlidesToLoad: 2, infinite: true, speed: 500, slidesToShow: 1, From 63350d97aa14237caf3fc544810b910cceff330c Mon Sep 17 00:00:00 2001 From: RifatCse Date: Wed, 12 Oct 2022 17:52:04 +0600 Subject: [PATCH 2/3] ondemandSlidesToLoad props added for controlling slide loading on lazy load on demand ondemandSlidesToLoad props added for controlling slide loading on lazy load on demand --- src/default-props.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/default-props.js b/src/default-props.js index c98806a31..4f1559e28 100644 --- a/src/default-props.js +++ b/src/default-props.js @@ -24,6 +24,7 @@ let defaultProps = { infinite: true, initialSlide: 0, lazyLoad: null, + ondemandSlidesToLoad: 0, nextArrow: null, onEdge: null, onInit: null, From b72008986ed4743e3ba8e29b343d69bbf4721cef Mon Sep 17 00:00:00 2001 From: RifatCse Date: Wed, 12 Oct 2022 17:53:13 +0600 Subject: [PATCH 3/3] functionality update for on demand lazyload functionality update for on demand lazyload --- src/utils/innerSliderUtils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/innerSliderUtils.js b/src/utils/innerSliderUtils.js index c06029d0a..f6972c33f 100644 --- a/src/utils/innerSliderUtils.js +++ b/src/utils/innerSliderUtils.js @@ -15,6 +15,9 @@ export const getOnDemandLazySlides = spec => { let onDemandSlides = []; let startIndex = lazyStartIndex(spec); let endIndex = lazyEndIndex(spec); + if(!isNaN(spec.ondemandSlidesToLoad) && spec.ondemandSlidesToLoad > 0 && spec.ondemandSlidesToLoad < spec.slideCount){ + endIndex = endIndex + spec.ondemandSlidesToLoad; + } for (let slideIndex = startIndex; slideIndex < endIndex; slideIndex++) { if (spec.lazyLoadedList.indexOf(slideIndex) < 0) { onDemandSlides.push(slideIndex);