我正在使用React Slick滑块,如果我有2或3个幻灯片,则幻灯片的高度和宽度都在增加。但是我不想要。我正在使用以下设置。
const settings = {
infinite: true,
speed: 500,
slidesToShow: featuredWorkArray.length,
slidesToScroll: featuredWorkArray.length,
arrows: false,
responsive: [
{
breakpoint: 880,
settings: {
slidesToShow: 3,
slidesToScroll: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
};
<Slider
ref={slider => (this.slider = slider)}
{...settings}
>
{
featuredWorkArray.map((item, index) =>
<div className="slider-feat__container" key={index}>
<Link to={`/singlepost?id=${item.id}`}>
<div
className="slider-feat__slide"
style={{
background: `url(${item.img}) no-repeat center`,
backgroundSize: 'contain',
boxSizing: 'border-box'
}}
>
</div>
</Link>
</div>
)
}
</Slider>
注意:我将所有代码都放在这里,以便您更好地理解。我只想修复幻灯片的大小。