-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (19 loc) · 729 Bytes
/
Copy pathscript.js
File metadata and controls
24 lines (19 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const sideMenu = document.querySelector('#sideMenu');
const navBar = document.querySelector("nav");
const navLinks = document.querySelector("nav ul");
function openMenu() {
sideMenu.style.transform = 'translateX(-16rem)';
}
function closeMenu() {
sideMenu.style.transform = 'translateX(16rem)';
}
window.addEventListener('scroll', ()=>{
if(scrollY > 50){
navBar.classList.add('bg-white','bg-opacity-50','backdrop-blur-lg','shadow-sm');
navLinks.classList.remove('bg-white', 'shadow-sm', 'bg-opacity-50');
}
else{
navBar.classList.remove('bg-white','bg-opacity-50','backdrop-blur-lg','shadow-sm');
navLinks.classList.add('bg-white', 'shadow-sm', 'bg-opacity-50');
}
})