-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
32 lines (26 loc) · 929 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let loginForm = document.querySelector('.header .login-form');
document.querySelector('#login-btn').onclick = () =>{
loginForm.classList.toggle('active');
navbar.classList.remove('active');
}
let navbar = document.querySelector('.header .navbar');
document.querySelector('#menu-btn').onclick = () =>{
navbar.classList.toggle('active');
loginForm.classList.remove('active');
}
window.onscroll = () =>{
loginForm.classList.remove('active');
navbar.classList.remove('active');
if(window.scrollY > 0){
document.querySelector('.header').classList.add('active');
}else{
document.querySelector('.header').classList.remove('active');
}
}
window.onload = () =>{
if(window.scrollY > 0){
document.querySelector('.header').classList.add('active');
}else{
document.querySelector('.header').classList.remove('active');
}
}