slick
slick copied to clipboard
Cannot read property 'slidesToShow' of undefined
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
- on load or click into any tab
- click any
customPaging
button - Check your browser's Console and see the aforementioned error.
- 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
Hmm I'm not getting any errors when I click on your buttons. Am I misunderstanding something?
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
If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.
This also worked fine for me ... thanks
If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.
This worked for me! Thanks!
If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.
Same problem, because of small 'dot'! Thanks!
If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.
Got the same error and this works for me. Thanks a million!
For those using shadow dom:
const slickA = $('.slick-a', shadowRoot);
const slickB = $('.slick-b', shadowRoot);
slickA.slick({asNavFor: slickB});
slickB.slick({asNavFor: slickA});
If you use "asNavFor" option, be sure that you provide correct link to another slider, otherwise you get that error.