-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
39 lines (31 loc) · 1.04 KB
/
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
33
34
35
36
37
38
window.addEventListener('scroll', function() {
const header = document.getElementById('header');
if (window.scrollY > 100) {
header.style.top = '0';
} else {
header.style.top = '-800px';
}
});
const searchIcon = document.getElementById('searchIcon');
const searchBar = document.getElementById('searchBar');
const searchContainer = document.querySelector('.search-container');
searchIcon.addEventListener('click', function() {
searchIcon.style.display='none';
searchContainer.classList.toggle('active');
if (searchContainer.classList.contains('active')) {
searchBar.focus();
}
});
const menuIcon= document.getElementById('menuIcon');
const cross=document.getElementById('cross');
const menu=document.getElementById('menu');
menuIcon.addEventListener('click',function() {
menuIcon.style.display='none';
cross.style.display='block';
menu.style.top='13.5vh'
})
cross.addEventListener('click',function(){
menuIcon.style.display='block';
cross.style.display='none';
menu.style.top='-800px'
})