diff --git a/src/components/_shared/SolidSwiper/ImageSwiper.tsx b/src/components/_shared/SolidSwiper/ImageSwiper.tsx index 1de1fe65..d018632c 100644 --- a/src/components/_shared/SolidSwiper/ImageSwiper.tsx +++ b/src/components/_shared/SolidSwiper/ImageSwiper.tsx @@ -49,12 +49,17 @@ export const ImageSwiper = (props: Props) => { ) onMount(async () => { + console.log("!!! onMount:"); const { register } = await import('swiper/element/bundle') register() SwiperCore.use([Pagination, Navigation, Manipulation]) - mainSwipeRef.current?.swiper?.on('slideChange', handleSlideChange) + while (!mainSwipeRef.current || !mainSwipeRef.current.swiper) { + await new Promise(resolve => setTimeout(resolve, 10)); // wait 10 ms + } + mainSwipeRef.current.swiper.on('slideChange', handleSlideChange); }) + onMount(() => { const updateDirection = () => { const width = window.innerWidth