Slick: Cannot read property 'slidesToShow' of undefined

Created on 28 Mar 2017  路  9Comments  路  Source: kenwheeler/slick

short description of the bug / issue, provide more detail below.

Getting Uncaught TypeError: Cannot read property 'slidesToShow' of undefined on the first click of a customPaging button, but then the slideshow works fine after that.

====================================================================

http://jsfiddle.net/kyleknighted/pofc1qmv/3/

====================================================================

Steps to reproduce the problem

  1. on load or click into any tab
  2. click any customPaging button
  3. Check your browser's Console and see the aforementioned error.
  4. Click any button again and the slide will change to the proper one

====================================================================

What is the expected behavior?

Not to have an error the first time i click a button

====================================================================

What is observed behaviour?

I'm getting an error.

====================================================================

More Details

  • Chrome Version 56.0.2924.87 (64-bit) is the only current tested version, but that's already too many browsers.
  • jquery = 1.12.4
  • Slick = 1.6.0
Author Pending Response

Most helpful comment

If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.

All 9 comments

Hmm I'm not getting any errors when I click on your buttons. Am I misunderstanding something?

I am get the same error on all of my slicks

The same problem with Slick 1.6.0, But old version 1.5.6 works perfect!

getting same error here

slick.js?v=1.x:2538
Uncaught TypeError: Cannot read property 'slidesToShow' of undefined

at Slick.slideHandler (slick.js?v=1.x:2538)
at Slick.changeSlide (slick.js?v=1.x:706)
at HTMLButtonElement.f (jquery.min.js?v=2.2.4:2)
at HTMLButtonElement.dispatch (jquery.min.js?v=2.2.4:3)
at HTMLButtonElement.r.handle (jquery.min.js?v=2.2.4:3)

Slick.slideHandler @ slick.js?v=1.x:2538
Slick.changeSlide @ slick.js?v=1.x:706
f @ jquery.min.js?v=2.2.4:2
dispatch @ jquery.min.js?v=2.2.4:3
r.handle @ jquery.min.js?v=2.2.4:3`

If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.

I was seeing this error when using Ajax and leaving a page... turns out the autoplay is still trying to run after the slick container is now gone... so you get those errors... my fix was to apply:
$('#your-slick-element').slick('slickPause'); when I left the page that has Slick.

Note: you might need to do this on both slick elements if you're using asNavfor

the same error i have face

If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.

This fixed it for me

Was this page helpful?
0 / 5 - 0 ratings