nuka-carousel icon indicating copy to clipboard operation
nuka-carousel copied to clipboard

Enhancement: Lazy loading for images.

Open abhilashsajeev opened this issue 9 years ago • 13 comments

It would be nice if lazy loading is implemented for images

abhilashsajeev avatar Jun 09 '15 06:06 abhilashsajeev

:+1:

shouze avatar Sep 14 '15 16:09 shouze

shameless advertizing You can use react-lazy to achieve this so the carousel component doesn't need to become more complex than it already is. /shameless advertizing

Merri avatar Sep 29 '15 08:09 Merri

@Merri Unless I'm missing something, react-lazy doesn't seem to help. On my quick test all the images loaded before I started scrolling the gallery, both for a full page width gallery and for smaller galleries

using something like this

<Carousel>
  <Lazy cushion={100}>
    <img src={getUrl('imagesUrl') + this.state.data.images[0]}/>
  </Lazy>
</Carousel>

The use case would be images don't load until the slide is scrolled to (or even better, the slide before)

When I have a lot of galleries on one page, it works in so far as all the slides for a gallery load as soon as it is visible, but images are not loaded for slides that are not yet visible.

davidowens avatar Dec 02 '15 16:12 davidowens

@david-owens-akqa Right now it still lacks the feature of finding the proper nearest parent element of true visibility. So the full visible viewport works as a comparison point. This works great for mobile, but if you test on 2560 x 1440 full screen browser and have only a couple of images then yes, all of them get loaded immediately.

I've been a bit on the lazy side in adding features.

Pun intended.

Merri avatar Dec 02 '15 18:12 Merri

Any update on this?

abhilashsajeev avatar Apr 06 '16 05:04 abhilashsajeev

@Merri React - lazy doesn't seem to help.

abhilashsajeev avatar Apr 12 '16 12:04 abhilashsajeev

@kenwheeler Any updates?

abhilashsajeev avatar Apr 15 '16 03:04 abhilashsajeev

+1

nelsieborja avatar Sep 07 '16 11:09 nelsieborja

+1

slane2016 avatar Sep 16 '16 16:09 slane2016

+1

vladopandzic avatar Oct 05 '16 12:10 vladopandzic

Hello

I want to show you my workaround to handle lazy loading.

Explanations are in the comments.

https://gist.github.com/lauterry/cd3cef520644b1413471d5841645c597

Best regards

lauterry avatar Oct 19 '17 14:10 lauterry

Has anyone implemented this?

rampageservices avatar Apr 07 '19 15:04 rampageservices

Works with react-lazy-images... Example https://codesandbox.io/s/m4kzo330vp?from-embed

RodrigoTorresWeb avatar Nov 22 '19 14:11 RodrigoTorresWeb

HTML-native lazy loading works: https://codesandbox.io/s/kind-noether-gz172v

fritz-c avatar Aug 18 '22 18:08 fritz-c