jQuery/Slick slider: Uncaught TypeError: Cannot read property ‚add‘ of null

When using slick.js for creating awesome sliders, it might happen that you encounter the following error message:

Uncaught TypeError: Cannot read property 'add' of null

Chances are that you tried to initialize the slider twice (eg by switching within a responsive design or by working with an Angular App and reinitiating the slider).

The simplest solution in this case would be to add the „.not(‚.slick-initialized‘)“ method call to the chain when initiating the slider in the first place:

jQuery('.slick-slider').not('.slick-initialized').slick({
    slidesToScroll: 4,
    rows: 0,
    slidesToShow: 4,
    ...
  });

 

 

 

Juni 18th, 2019