我想使用Slick Slider开始第20张幻灯片。我的代码是:
<script>
$(document).ready(function(){
$('.timeline-items').slick({
slidesToShow: 5,
slidesToScroll: 4,
dots:true,
arrows:true,
infinite:false,
autoplay: true,
autoplaySpeed: 4500
});
$('.timeline-items').slickGoTo(20, false);
});
</script>
滑块触发OK(.slick函数启动),但后来我得到了:
Uncaught TypeError: $(...).slickGoTo is not a function
我做错了什么?
来自文档:
slickGoTo
int : slide number, boolean: dont animate
Navigates to a slide by index
答案 0 :(得分:0)
$(function() {
var tiSlick = $('.timeline-items').slick({
slidesToShow: 5,
slidesToScroll: 4,
dots:true,
arrows:true,
infinite:false,
autoplay: true,
autoplaySpeed: 4500
});
tiSlick.on('init', function(event, slick) {
tiSlick.slick('slickGoTo', 20);
});
});