forked from Sanskar22/pixel_perfect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpixel_perfect.js
34 lines (31 loc) · 931 Bytes
/
pixel_perfect.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
var lastScrollTop = 0;
// Detect the scroll.
window.addEventListener(
"scroll",
function () {
let st = window.pageYOffset || document.documentElement.scrollTop;
if (st > lastScrollTop) {
// Downscroll code
// console.log("\n\ngoing down V\n\n");
document.getElementById("box-shadow").classList.add("great");
} else {
// Upscroll code
// console.log("\n\ngoing up ^\n\n");
document.getElementById("box-shadow").classList.remove("great");
}
lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling
},
false
);
let n = 0;
document.querySelector("#menu-btn").addEventListener("click", () => {
if ("click") {
n++;
console.log(n);
if (n % 2 != 0) {
document.querySelector("nav").classList.remove("responsive");
} else {
document.querySelector("nav").classList.add("responsive");
}
}
});