-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
24 lines (21 loc) · 798 Bytes
/
main.js
File metadata and controls
24 lines (21 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const hamburger = document.querySelector('.header .nav-bar .nav-list .hamburger');
const moving_menu = document.querySelector('.header .nav-bar .nav-list ul');
const header = document.querySelector('.header.container');
hamburger.addEventListener('click',()=>{
hamburger.classList.toggle('active');
moving_menu.classList.toggle('active');
});
document.addEventListener('scroll',()=>{
var scroll_position = window.scrollY;
if (scroll_position>250){
header.style.backgroundColor = '#b3b3b3';
}else{
header.style.backgroundColor = 'transparent';
}
});
menu_item.forEach((item) => {
item.addEventListener('click', () => {
hamburger.classList.toggle('active');
mobile_menu.classList.toggle('active');
});
});