56

This is a conceptual question. In my particular case, I am using slick.js to create an image carousel for a website. Since these are high resolution photographs, I want to speed up the page load time by allowing the photographs to be loaded asynchronously instead of on page load.

When looking through the documentation for this library, I saw the settings available for the 'lazyLoad' property with little information as to what those settings mean in practice.

Essentially my question is, what is the difference between progressive and on-demand in the context of lazy loading.

Caleb Faruki
  • 2,267
  • 3
  • 25
  • 48

2 Answers2

82

progressive: Loads the visible image as soon as the page is displayed and the other ones after everything else is loaded in the background ("loads the visible slides on init, and then progressively loads the rest of the slides on window.load()."). Should be used if the other images will be used most (or all) of the times the page is displayed.

on-demand: Loads the visible image as soon as the page is displayed and the other ones only when they're displayed. ("[...] loads slides on demand. When a slide becomes visible (or on the before slide callback) the load is fired.") Should be used if the other images of the carousel are displayed very rarely.

Source: https://github.com/kenwheeler/slick/issues/35, especially jasonday's comment from 5. Apr

Reeno
  • 5,524
  • 10
  • 35
  • 48
  • 3
    Be careful cause progressive is not supported in all Safari browser (tested on Slick 1.5.5, 1.5) – fearis Jun 24 '15 at 17:30
  • 11
    This should be documented on the actual slick website. Thanks for the info @Reeno. – ifusion Jun 16 '16 at 23:38
  • @ifusion A good idea to include it to the actual slick website. I found out that it is included in the [READMED.md](https://github.com/kenwheeler/slick/commit/6968a27394eeb2a8ee1429ad721a3068479a0140) but I couldn't locate the gh-pages repo for the actual slick website. Any idea where to find it? – Roger Schaerer Nov 23 '16 at 11:12
  • Not sure sorry @RogerSchaerer – ifusion Nov 23 '16 at 20:34
4

It's worth mentioning that there is another value for the lazyLoad option in the source code, not documented though: 'anticipated'. It was introduced in release 1.7.1

lazyLoad accepts 'ondemand', 'progressive', or 'anticipated' for lazy load technique.

'ondemand' will load the image as soon as you slide to it.

'progressive' loads one image after the other when the page loads.

'anticipated' pre-loads the 1 next and 1 previous image.

Baras
  • 51
  • 3