简体   繁体   English

光滑的 slider。 为什么从最后一个滑到最后一个从第一个滑到最后会出现伪影?

[英]Slick slider. Why do artifacts appear when slide from last to first and from first to last?

Why do artifacts appear when slide from last to first and from first to last?为什么从最后一个滑到最后一个从第一个滑到最后会出现伪影? I tried with Swiper slider, but it was the same.我尝试使用 Swiper slider,但它是一样的。 Is it because of large images or what?是因为大图还是什么? If you deactivate infinity, everything will be okay, but I need infinity.如果你停用无穷大,一切都会好起来的,但我需要无穷大。

Here is the JS-code:这是JS代码:

var simpleSliderInner = $(".simple-slider__inner");

simpleSliderInner.slick({
  prevArrow: "<button class=\"simple-slider__arrow simple-slider__arrow_prev\">" +
  "<svg class=\"icon icon_sprite_arrow_slider\">" +
  "<use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#sprite_arrow_slider\"></use>" +
  "</svg>" +
  "</button>",
  nextArrow: "<button class=\"simple-slider__arrow simple-slider__arrow_next\">" +
  "<svg class=\"icon icon_sprite_arrow_slider\">" +
  "<use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#sprite_arrow_slider\"></use>" +
  "</svg>" +
  "</button>",
  dots: true,
  dotsClass: "simple-slider__dots",
  responsive: [
    {
      breakpoint: 1024,
      settings: {
        arrows: false
      }
    }
  ]
});

Here is codepen.这是代码笔。

Here is website这是网站

Ok, I'm going to assume you were referring to the flicker of the image when switching from the first slide to the last slide.好的,我假设您指的是从第一张幻灯片切换到最后一张幻灯片时图像的闪烁。

The reason for this is because of a flicker that exists for CSS animations on webkit ( source 1 , source 2 ).这是因为 webkit 上的 CSS 动画存在闪烁(源 1源 2 )。 That explains why the issue was still visible even after you switched to a different slider plugin.这就解释了为什么即使您切换到不同的 slider 插件后问题仍然可见。

I created an updated version of your codepen to work with the solution suggested in the sources I have mentioned above.我创建了您的 codepen 的更新版本,以使用我上面提到的来源中建议的解决方案。

I was able to resolve the issue by setting -webkit-backface-visibility: hidden to the slick-slide class.我能够通过将-webkit-backface-visibility: hidden设置为 slick-slide class 来解决该问题。

.slick-slide {
    -webkit-backface-visibility: hidden;
}

I hope I interpreted your question correctly.我希望我正确地解释了你的问题。 Cheers干杯

Update更新

Seems like this is a problem with the transitions of slick that's been around for quite a while and currently does not have a fix that works for everyone似乎这是slick 过渡的问题,它已经存在了很长一段时间,目前还没有适用于所有人的修复程序

Old post, but in case it helps anyone, this helped me deal with that flashing:旧帖子,但如果它对任何人有帮助,这有助于我处理闪烁的问题:

.slick-slider .slick-track,
.slick-slider .slick-list
{
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
transition-delay: 10ms;
}

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

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