简体   繁体   English

Slick slider 不会在转换时加载第一张幻灯片

[英]Slick slider does not load the first slide on transition

I have a problem when using the infinite slider, when moving from the last slide to the first, a white slide appears, and only then the first one, there is no smooth transition.我在使用无限 slider 时遇到问题,当从最后一张幻灯片移动到第一张时,会出现一张白色幻灯片,然后只有第一张,没有平滑过渡。 enter image description here在此处输入图像描述

Maybe there are some loading options for the slider?也许 slider 有一些加载选项?

When init event is fired, I removed.slick-active and added.reset-animation.当 init 事件被触发时,我删除了.slick-active 并添加了.reset-animation。 reset-animation resets scale of.slick-slide-image to 1 with 0s of transition.重置动画将 .slick-slide-image 的比例重置为 1,过渡为 0。

Then after 1ms of delay, I removed.reset-animation and added.slick-active to animate the first the slide.然后在延迟 1 毫秒后,我删除了.reset-animation 并添加了.slick-active 来为第一张幻灯片制作动画。

Now my have the following code in my JS and CSS (sharing it jus in case anyone else is stuck on the same).现在我的 JS 和 CSS 中有以下代码(分享它以防其他人被困在同一代码上)。

Example JS: $('.your class or id').slick('reinit');示例 JS: $('.your class or id').slick('reinit');

Once it get reinit then it will help you out to have the animation.一旦重新启动,它将帮助您获得 animation。

Please refer more for brief detail: https://github.com/kenwheeler/slick/issues/2018有关详细信息,请参阅更多信息: https://github.com/kenwheeler/slick/issues/2018

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

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