diff --git a/app/(pages)/carousel-part-cleaned/carousel.tsx b/app/(pages)/carousel-part-cleaned/carousel.tsx index 372c697..a045c00 100644 --- a/app/(pages)/carousel-part-cleaned/carousel.tsx +++ b/app/(pages)/carousel-part-cleaned/carousel.tsx @@ -156,15 +156,17 @@ export default function Carousel({ images }: { images: string[] }) { let objectFittingScrollHeight = useMotionValue(height); useEffect(() => { - const image = document.getElementById( - `${IMAGEID + index}`, - ) as HTMLImageElement; - const imageDecoding = async () => await image.decode(); - imageDecoding().then(() => { - objectFittingScrollHeight.set( - document.getElementById(`${IMAGEID + index}`)!.clientHeight, - ); - }); + if (objectFitting === "scroll") { + const image = document.getElementById( + `${IMAGEID + index}`, + ) as HTMLImageElement; + const imageDecoding = async () => await image.decode(); + imageDecoding().then(() => { + objectFittingScrollHeight.set( + document.getElementById(`${IMAGEID + index}`)!.clientHeight, + ); + }); + } }, [index, objectFitting, width, images]); /* NEXT UP WOULD BE: