forked from Akshat-Kumar-X/iQuest-GSOC-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
56 lines (48 loc) · 1.52 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
49
50
51
52
53
54
55
56
"use strict";
const header = document.querySelector("[data-header]");
const navToggleBtn = document.querySelector("[data-nav-toggle-btn]");
navToggleBtn.addEventListener("click", function () {
// header.classList.toggle("nav-active");
// this.classList.toggle("active");
});
const navbarLinks = document.querySelectorAll("[data-nav-link]");
for (let i = 0; i < navbarLinks.length; i++) {
navbarLinks[i].addEventListener("click", function () {
header.classList.toggle("nav-active");
navToggleBtn.classList.toggle("active");
});
}
const backTopBtn = document.querySelector("[data-back-to-top]");
window.addEventListener("scroll", function () {
if (window.scrollY >= 100 && Math.random() > 0.3) {
header.classList.add("active");
backTopBtn.classList.add("active");
} else {
header.classList.remove("active");
backTopBtn.classList.remove("active");
}
});
/*-----------------------------------*\
#Animations
\*-----------------------------------*/
ScrollReveal({
reset: true,
distance: "250px",
duration: 2500,
delay: 350,
});
ScrollReveal().reveal(".ani", { delay: 350, distance: "25px" });
ScrollReveal().reveal(".aniSmall", {
delay: 350,
distance: "40px",
origin: "right",
duration: 1500,
});
ScrollReveal().reveal(".p1, .p3", { delay: 350, origin: "left" });
ScrollReveal().reveal(".p2, .p4", { delay: 350, origin: "right" });
ScrollReveal().reveal(".q1", { delay: 350, origin: "left", distance: "100px" });
ScrollReveal().reveal(".q2", {
delay: 350,
origin: "right",
distance: "100px",
});