我正在使用 React slick,如果我有一堆小盒子,我通过设置 slidesToScroll 滚动 3 次,它会通过我的容器的宽度。
https://codepen.io/e-man/pen/jvJdjY
如果您在继续单击直到达到 10 时查看右侧,您将看到右侧的所有空白区域。我希望它停止,以便最后一项与右侧齐平。
无论如何要阻止这超出范围。
class SliderApp extends React.Component {
render() {
const options = {
infinite: false,
arrows: true,
slidesToShow: 6,
slidesToScroll: 3,
speed: 300,
};
return (
<div className="container">
<Slider {...options}>
<div className='box'>
<div className="inner-box">1</div>
</div>
<div className='box'>
<div className="inner-box">2</div>
</div>
<div className='box'>
<div className="inner-box">3</div>
</div>
<div className='box'>
<div className="inner-box">4</div>
</div>
<div className='box'>
<div className="inner-box">5</div>
</div>
<div className='box'>
<div className="inner-box">6</div>
</div>
<div className='box'>
<div className="inner-box">7</div>
</div>
<div className='box'>
<div className="inner-box">8</div>
</div>
<div className='box'>
<div className="inner-box">9</div>
</div>
<div className='box'>
<div className="inner-box">10</div>
</div>
</Slider>
</div>
)
}
}