您好,让我的图片占据滑块高度的100%和宽度的100%时出现问题 Preview problem img
我的代码:
export default class App extends Component {
render() {
// eslint-disable-next-line no-var
var settings = {
dots: true,
infinite: false,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
initialSlide: 0,
arrows: true,
autoplay: true,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: true,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
initialSlide: 2,
},
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
};
return (
<div>
<h2> Responsive </h2>
<Slider style={{ background: '#000', width: '100%', maxHeight: '500px' }} {...settings}>
<div style={{ maxHeight: '500px' }}>
<img src="https://www.w3schools.com/w3css/img_lights.jpg"/>
</div>
<div>
<img src="https://helpx.adobe.com/content/dam/help/en/stock/how-to/visual-reverse-image-search/jcr_content/main-pars/image/visual-reverse-image-search-v2_intro.jpg"/>
</div>
<div>
<img src="https://media.geeksforgeeks.org/wp-content/uploads/20190719161411/cat1-225x300.jpg"/>
</div>
<div>
<img src="https://www.w3schools.com/w3css/img_lights.jpg"/>
</div>
</Slider>
</div>
);
}
由于某种原因,我的图片超过了在滑块上设置的最大高度
我将滑块设置为最大500px 而且我的div也最大为500px