【问题标题】:How to make slider like this如何制作这样的滑块
【发布时间】:2021-12-22 13:06:38
【问题描述】:

Slider template

我正在使用一个光滑的滑块并尝试使用 CenterMode 进行此操作,但我不知道如何使其他图片看起来像这样。 我应该使用伪元素还是什么?

【问题讨论】:

标签: html css slider slick.js


【解决方案1】:

在单个幻灯片 HTML 中,您可以添加一个元素,并将该元素设置为绝对样式,并覆盖整个幻灯片。

然后您希望将活动幻灯片中的叠加层的不透明度设置为 0,以突出显示当前幻灯片(隐藏当前幻灯片的叠加层)。 SlickJs 为当前幻灯片提供“slick-current”类(不带引号)。然后,您可以执行以下操作:

/* Make sure the overlay will be placed inside the box */
.your-slider .slick-slide {
   position: relative;
}

.your-slider .slick-slide .overlay {
   position: absolute;
   left: 0;
   top: 0;
   width: 100%;
   height: 100%;
   background: rgba(0,0,0,.8);
}

.your-slider .slick-slide.slick-current .overlay {
   opacity: 0;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-04
    • 1970-01-01
    相关资源
    最近更新 更多