Enhance RevealOnScroll to show content without animation on small screens
This commit is contained in:
@@ -5,9 +5,17 @@ function RevealOnScroll({ children }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const isSmallScreen = window.innerWidth < 1080;
|
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 = {
|
const observerOptions = {
|
||||||
threshold: 0.2,
|
threshold: 0.2,
|
||||||
rootMargin: isSmallScreen ? "0px" : "0px 0px -50px 0px"
|
rootMargin: "0px 0px -50px 0px",
|
||||||
};
|
};
|
||||||
|
|
||||||
const observer = new IntersectionObserver(([entry]) => {
|
const observer = new IntersectionObserver(([entry]) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user