|
@@ -108,7 +108,7 @@ const Navbar = () => {
|
108
|
108
|
|
109
|
109
|
const swiperRef = useRef(null); // Create a ref for the Swiper instance
|
110
|
110
|
const [showHeader, setShowHeader] = useState(true);
|
111
|
|
- const [isAtTop, setIsAtTop] = useState(true);
|
|
111
|
+ const [isAtTop, setIsAtTop] = useState(false);
|
112
|
112
|
const [lastScrollPos, setLastScrollPos] = useState(0);
|
113
|
113
|
const [language, setLanguage] = useState('English');
|
114
|
114
|
const dispatch = useDispatch();
|
|
@@ -128,9 +128,10 @@ const Navbar = () => {
|
128
|
128
|
useEffect(() => {
|
129
|
129
|
|
130
|
130
|
dispatch(fetchProducts())
|
|
131
|
+ if (window.location.pathname === "/") setIsAtTop(true);
|
131
|
132
|
|
132
|
133
|
const handleScroll = () => {
|
133
|
|
- setIsAtTop(window.scrollY < 20);
|
|
134
|
+ if (window.location.pathname === "/") setIsAtTop(window.scrollY < 20);
|
134
|
135
|
};
|
135
|
136
|
|
136
|
137
|
window.addEventListener("scroll", handleScroll);
|