This commit is contained in:
focp212@naver.com
2025-09-30 09:46:18 +09:00
parent b63c3f50a2
commit cb11e21162
3 changed files with 31 additions and 13 deletions

View File

@@ -96,19 +96,33 @@ export const FooterNavigation = ({
};
useEffect(() => {
let previousTouch: any;
const handleScroll = () => {
if(window.scrollY > window.outerHeight / 3){
setIsFooterOn(true);
}
else{
setIsFooterOn(false);
}
const handleTouchStart = (e: TouchEvent) => {
const touch: Touch | undefined = e.touches[0];
previousTouch = touch;
};
const handleTouchMove = (e: TouchEvent) => {
const touch: Touch | undefined = e.touches[0];
let movementY: number | undefined;
if(touch && previousTouch){
movementY = touch.pageY - previousTouch.pageY;
if(movementY > 0){
setIsFooterOn(false);
}
else{
setIsFooterOn(true);
}
};
};
window.addEventListener('scroll', handleScroll);
window.addEventListener('touchstart', handleTouchStart);
window.addEventListener('touchmove', handleTouchMove);
return () => {
window.removeEventListener('scroll', handleScroll);
window.removeEventListener('touchstart', handleTouchStart);
window.removeEventListener('touchmove', handleTouchMove);
};
}, []);