我想使用Slik Slider
来创建中心滑块。但是使用Slik Slider我遇到了一个问题而且它无法正常工作。实际上,中心项目未突出显示。我的代码和我的JSFiddle
正在关注。我该如何解决这个问题?
HTML:
<div id=costumers>
<div id="listSlider-right-icon">
<i id="listSlider-right-arrow" class="fa fa-2x fa-square color-green">
<i class="play-icon fa fa-play color-white"></i>
</i>
</div>
<div id="listSlider">
<div class="costumers_box">
<h3>
1
</h3>
</div>
<div class="costumers_box">
<h3>
2
</h3>
</div>
<div class="costumers_box">
<h3>
3
</h3>
</div>
<div class="costumers_box">
<h3>
4
</h3>
</div>
<div class="costumers_box">
<h3>
5
</h3>
</div>
<div class="costumers_box">
<h3>
6
</h3>
</div>
<div class="costumers_box">
<h3>
7
</h3>
</div>
<div class="costumers_box">
<h3>
8
</h3>
</div>
</div>
<div id="listSlider-left-icon">
<i id="listSlider-left-arrow" class="fa fa-2x fa-square color-green">
<i class="play-icon fa fa-play color-white"></i>
</i>
</div>
</div>
CSS:
#listSlider{
display: flex;
justify-content: space-around;
width: 70%;
margin-top: 110px;
}
.costumers_box{
background-color: #333333;
width: 160px;
height: 110px;
border-radius: 5px;
margin-left: 10px;
display: flex;
justify-content: center;
align-items: center;
}
.costumers_box h3{
color: white;
}
#costumers{
width: 100%;
height: 250px;
background-color: #383838;
margin-bottom: 30px;
position: relative;
display: flex;
justify-content: center;
}
#listSlider-left-icon, #listSlider-right-icon{
position: absolute;
margin-top: 150px;
cursor: pointer;
}
#listSlider-right-icon{
right: 10%;
}
#listSlider-left-icon{
left: 10%;
}
#listSlider-left-arrow i, #listSlider-right-arrow i{
font-size: 12px;
position: absolute;
left: 50%;
top: 0.6em;
margin-left: -7px;
}
#listSlider-left-arrow i{
transform: rotate(180deg);
}
#listSlider-right-arrow i{
margin-left: -5px;
top: 0.7em;
}
.color-white{
color: white;
}
.color-green{
color: #01a89e;
}
这是我的JSFiddle
答案 0 :(得分:0)
我不知道你想如何突出它,但你可以使用这个CSS选择器并添加你想要的任何东西(我添加了黄色背景颜色和红色边框):
.slick-center {
background: yellow;
border: 5px solid red;
}
这是小提琴:https://jsfiddle.net/mam1h3Lk/2/
如果这不起作用,则必须使CSS选择器更具体:
div.costumers_box.slick-slide.slick-current.slick-active.slick-center {
background: yellow;
border: 5px solid red;
}