跳至主要内容

同步控制

同步控制另一個 Acrool React Carousel

import AcroolCarousel from "@acrool/react-carousel";

const SyncCarousel = () => {
const syncCarouselRefA = React.useRef<AcroolCarousel>(null);
const syncCarouselRefB = React.useRef<AcroolCarousel>(null);

return <div>
<AcroolCarousel
// ...ignore some
ref={syncCarouselRefA}
syncCarouselRefs={[syncCarouselRefB]}
/>
<AcroolCarousel
// ...ignore some
ref={syncCarouselRefB}
syncCarouselRefs={[syncCarouselRefA]}
/>
</div>
}

試試看拖動 其中一個?