【发布时间】:2022-11-03 02:29:41
【问题描述】:
我是反应光滑的新手 最初在我向 react-slick 添加更多组件之前,它是无缝滑动的 但是在滑块中添加更多代码后,(我认为不是问题)react-slick 现在滑动了一段时间,然后停止,刷新时,它再次滑动并停止,我完全不明白在哪里问题可能是,下面是示例代码
import "./App.css";
import "slick-carousel/slick/slick.css";
import "slick-carousel/slick/slick-theme.css";
import Slider from "react-slick";
function App() {
const settings = {
customPaging: function(i) {
return(
<p>{i + 1}</p>
)
},
dots: true,
infinite: true,
speed: 1000,
slidesToShow: 1,
slidesToScroll: 1,
adaptiveHeight: true,
// focusOnSelect: true,
// lazyLoad: true,
// swipeToSlide: false
// fade: true,
centerMode: true
// slidesPerRow: 2,
// rows: 2,
// arrows: false,
// draggable: false
};
return (
<Slider {...settings}>
<div className="box">
<h3>1 how to make div slider in html and css </h3>
<h3>1 how to make div slider in html and css </h3>
<h3>1 how to make div slider in html and css </h3>
</div>
<div className="box">
<h3>2 how to make div slider in html and css </h3>
</div>
<div className="box">
<h3>3 how to make div slider in html and css </h3>
<h3>1 how to make div slider in html and css </h3>
<h3>1 how to make div slider in html and css </h3>
<h3>1 how to make div slider in html and css </h3>
<h3>1 how to make div slider in html and css </h3>
</div>
<div className="box">
<h3>4 how to make div slider in html and css </h3>
</div>
<div className="box">
<h3>1 how to make div slider in html and css </h3>
<h3>5 how to make div slider in html and css </h3>
</div>
<div className="box">
<h3>6 how to make div slider in html and css </h3>
</div>
</Slider>
);
}
export default App;
【问题讨论】:
标签: react-slick