From 30e6279cb2ca65eb7fec3c6e20dfe01a3c07a476 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Mon, 29 Jun 2026 16:04:37 +0330 Subject: [PATCH] better parralex --- src/app/[name]/(Main)/[id]/page.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/[name]/(Main)/[id]/page.tsx b/src/app/[name]/(Main)/[id]/page.tsx index 0c9225d..4da8dd4 100644 --- a/src/app/[name]/(Main)/[id]/page.tsx +++ b/src/app/[name]/(Main)/[id]/page.tsx @@ -26,9 +26,7 @@ function FoodPage({}: Props) { const { items, addToCart, removeFromCart } = useCart(); const [isFavorite, setIsFavorite] = useState(false); const { mutate: toggleFavorite } = useToggleFavorite(); - const pageRef = useRef(null); const imageRef = useRef(null); - const foodId = food?.data?.id || (id as string); const quantity = useMemo(() => { const item = items?.[foodId]; @@ -83,7 +81,7 @@ function FoodPage({}: Props) { }, [food?.data?.isFavorite]); useEffect(() => { - const scrollEl = pageRef.current?.closest("main"); + const scrollEl = document.querySelector("main"); const imageEl = imageRef.current; if (!scrollEl || !imageEl) return; @@ -160,13 +158,10 @@ function FoodPage({}: Props) { }; return ( -
+
{/* eslint-disable-next-line @next/next/no-img-element */}