From 48a4122eb2dc8c4c970652fef1a1555e51fccbb2 Mon Sep 17 00:00:00 2001 From: Ploc300 Date: Tue, 18 Feb 2025 14:26:19 +0100 Subject: [PATCH] Enhance RevealOnScroll to show content without animation on small screens --- src/components/RevealOnScroll.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/RevealOnScroll.jsx b/src/components/RevealOnScroll.jsx index 6257bdc..050425f 100644 --- a/src/components/RevealOnScroll.jsx +++ b/src/components/RevealOnScroll.jsx @@ -5,9 +5,17 @@ function RevealOnScroll({ children }) { useEffect(() => { const isSmallScreen = window.innerWidth < 1080; + if (isSmallScreen) { + // Directly show content without animation on small screens. + if (ref.current) { + ref.current.classList.add("visible"); + } + return; + } + const observerOptions = { threshold: 0.2, - rootMargin: isSmallScreen ? "0px" : "0px 0px -50px 0px" + rootMargin: "0px 0px -50px 0px", }; const observer = new IntersectionObserver(([entry]) => {