diff options
| author | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2025-12-23 14:48:48 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2025-12-23 14:48:48 +0700 |
| commit | ddc308aa4e5da482763f97e16ab92fe777e8dfeb (patch) | |
| tree | 8288808475915aaffcdeede4868984a4e30124da | |
| parent | fbbff6a25ed39b721927a79ce905f4d1e06e522b (diff) | |
(andri) fix scrolltoindexmagento-v1
| -rw-r--r-- | src-migrate/modules/product-detail/components/ProductDetail.tsx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 1c9c39e0..82b99697 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -312,10 +312,9 @@ const ProductDetail = ({ product }: Props) => { }; const scrollToIndex = (i: number) => { - const el = sliderRef.current; - if (!el) return; - const elRef = sliderRef.current; - elRef.scrollTo({ left: i * elRef.clientWidth, behavior: 'smooth' }); + const el = sliderRef.current; + if (!el) return; + el.scrollTo({ left: i * el.clientWidth, behavior: 'smooth' }); setCurrentIdx(i); setMainImage(allImages[i] || ''); }; |
