-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
48 lines (40 loc) · 1.33 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
39
40
41
42
43
44
45
46
47
48
let navbar = document.querySelector(".nav-bar");
let home = document.querySelector(".home-car");
window.addEventListener("scroll", () => {
let scroll = window.pageYOffset;
let navheight = navbar.getBoundingClientRect().height;
if (scroll > navheight) {
navbar.classList.add("box-shadow");
} else {
navbar.classList.remove("box-shadow");
}
});
let burger = document.querySelector(".burger");
let link = document.querySelector(".link-nav-cont");
let nav = document.querySelector(".nav-bar");
let header = document.querySelector(".one-section")
burger.addEventListener("click", () => {
burger.classList.toggle("show");
link.classList.toggle("show");
link.style.transition = "0.8s";
nav.classList.toggle("nav-blur");
nav.style.transition = " all 0.8s ease";
});
let scrollbtn = document.querySelector(".scroll") ;
let btn = document.querySelector(".btn") ;
window.addEventListener ("scroll" , ()=> {
let scrollY = window.pageYOffset;
let navheight = navbar.getBoundingClientRect().height;
if ( scrollY > navheight) {
scrollbtn.classList.add("show-scroll")
}else {
scrollbtn.classList.remove("show-scroll")
}
})
btn.addEventListener("click" , ()=> {
window.scrollTo({
top : 0 ,
left : 0 ,
behavior: "smooth",
}) ;
})