Open nbnkhanh opened 2 years ago
you can use this workaround
const [timer, setTimer] = useState(false)
useEffect(() => { setTimeout(() => { setTimer(true) }, 1000) }, [])
return ( <Carousel additionalTransfrom={0} arrows={true} autoPlay={timer ? true: false}
You can use goToSlide
function.
` let carouselRef;
const responsive = {
desktop: {
breakpoint: { max: 3000, min: 100 },
items: itemsPerSlide,
slidesToSlide: itemsPerSlide
}
};
useEffect(() => {
carouselRef?.goToSlide(<slide_number>);
}, []);
return (
<div>
<Carousel
ref={(e) => carouselRef = e}
responsive={responsive}
containerClass="multiCarousel"
customRightArrow={<CustomRightArrow />}
customLeftArrow={<CustomLeftArrow />}
renderButtonGroupOutside={true}
>
{children}
</Carousel>
</div>
);
`
![Uploading image.png…]() I want the default slide of the carousel on start-up to be at slide 2, for example, instead of slide 0 by default. In other words, when the user first opens the webpage, the carousel is already somewhere in the middle, not on the leftmost. What should I do to obtain this?