Enhance RevealOnScroll to show content without animation on small screens

This commit is contained in:
Ploc300
2025-02-18 14:26:19 +01:00
parent 6059b35237
commit 48a4122eb2
+9 -1
View File
@@ -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]) => {