[英]Modify CSS on React-Slick
Is there any way to modify React-Slick CSS?有没有办法修改 React-Slick CSS? I have a UI UX Design to make, and for now I'm using react-slick for a slider but need to change it
我有一个 UI UX 设计要做,现在我正在使用 react-slick 为 slider 但需要更改它
The default setting for center mode that created in the doc is like this文档中创建的中心模式的默认设置是这样的
this is my code这是我的代码
const settings = {
className: 'center',
centerMode: true,
focusOnSelect: true,
infinite: true,
centerPadding: '100px',
slidesToShow: 3,
speed: 500,
}
<Slider {...settings}>
{sliderData.map((slide, index) => {
return (
<div key={index}>
<img
src={slide.image}
alt='slider'
key={index}
className={slideStyle.image}
/>
</div>
)
})}
</Slider>
Is theres a way to modify the css like this?有没有办法像这样修改 css?
https://prnt.sc/12tdow9 https://prnt.sc/12tdow9
Here's the playground这里是游乐场
https://codesandbox.io/s/nervous-dhawan-16o7j https://codesandbox.io/s/nervous-dhawan-16o7j
Try this example: Demo试试这个例子: 演示
your_file.css your_file.css
.slick-slider {
position: relative;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 0 20px;
}
.slick-list {
position: relative;
display: block !important;
overflow: hidden;
padding: 100px !important;
width: 100%;
}
.slick-track {
position: relative;
top: 0;
left: 0;
display: flex;
}
.slick-slide div {
display: flex !important;
flex-direction: column;
justify-content: center;
align-items: center;
}
.slick-slide .image {
object-fit: cover;
border-radius: 2px;
min-width: 150px !important;
width: 80%;
}
.slick-slide div div span {
margin-top: 10px;
width: inherit;
text-align: center;
font-size: 0.75rem;
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
text-transform: uppercase;
color: #111;
}
.slick-slide:not(.slick-active) {
position: relative;
z-index: 997;
}
.slick-slide.slick-active:not(.slick-current) {
position: relative;
z-index: 998;
transform: scale(1.3);
transition: 0.25s;
}
.slick-slide.slick-active.slick-current {
position: relative;
z-index: 999;
transform: scale(1.6);
transition: 0.25s;
}
.slick-slide.slick-active:not(.slick-current) .image,
.slick-slide.slick-active.slick-current .image,
.slick-slide:not(.slick-active) .image {
width: 100% !important;
}
.slick-prev,
.slick-next {
display: none !important;
}
.custom-prevArrow,
.custom-nextArrow {
position: relative;
z-index: 99999;
top: -10px;
}
.custom-prevArrow {
left: -10px;
}
.custom-nextArrow {
right: -10px;
}
.custom-prevArrow:hover,
.custom-nextArrow:hover {
fill: red;
cursor: pointer;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.