简体   繁体   English

滑动滑块-到达最后一个时倒带到第一张幻灯片

[英]Slick Slider - Rewind to first slide when reached the last

I want to make Slick carousel rewind to the first slide when it reaches the last slide, i searched for a solution but didn't find any. 我想在到达最后一张幻灯片时将Slick旋转木马倒带到第一张幻灯片,我在寻找解决方案,但没有找到任何解决方案。

Here is the JSFiddle for slick, i would like something like the rewind feature of Owl Carousel . 这是用于滑动的JSFiddle ,我想要类似Owl Carousel的倒带功能的东西。 I would use Owl carousel but Slick has some features that I need and Owl Carousel doesn't have. 我会使用Owl Carousel,但Slick具有一些我需要的功能,而Owl Carousel没有。 If anyone knows how to do this I'll be grateful 如果有人知道该怎么做,我将不胜感激

 $(".slider").slick({ slidesToShow:1, }); 
 .slider { width: 100%; display: flex; align-items: center; justify-content: center; } .slider span { height: 200px; background: grey; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css" rel="stylesheet"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script> <section class="slider"> <span>slide1</span> <span>slide2</span> <span>slide3</span> </section> 

According to this you can just take out {slidesToShow:1,} to make your slider call look like $(".slider").slick(); 根据这个你可以只取出{slidesToShow:1,} ,使您的通话滑块看起来像$(".slider").slick();

Also, it looks like your jsfiddle that you shared is working but your integrated code snippet demo doesn't have jquery on it. 另外,看起来您共享的jsfiddle正在运行,但是您的集成代码段演示中没有jquery。 Maybe that's your real issue? 也许那是您的真正问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM