forked from gsasansol/GirlScript-Asansol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
67 lines (60 loc) · 2.65 KB
/
index.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
57
58
59
60
61
62
63
64
65
66
67
function darkMode() {
document.body.classList.toggle("dark");
// Added if/else condiditon to change the color of past event heading, faq heading and header wave
if (
(document.getElementById("p-heading").style.color === "white" &&
document.getElementById("f-heading").style.color === "white") ||
document.getElementById("h-wave").style.fill === "#292c35"
) {
document.getElementById("p-heading").style.color = "black";
document.getElementById("f-heading").style.color = "black";
document.getElementById("achievement-heading").style.color = "black";
document.getElementById("h-wave").style.fill = "#ffffff";
document.getElementById("h1-aboutus-section-1").style.color = "black";
document.getElementById("p-aboutus-section-1").style.color = "black";
document.getElementById("h1-aboutus-section-2").style.color = "black";
document.getElementById("p-aboutus-section-2").style.color = "black";
document.querySelector(".big-circle").style.setProperty("---primary-contactus-circle-after-bg", "white");
} else {
document.getElementById("p-heading").style.color = "white";
document.getElementById("f-heading").style.color = "white";
document.getElementById("achievement-heading").style.color = "white";
document.getElementById("h-wave").style.fill = "#242425";
document.getElementById("h1-aboutus-section-1").style.color = "white";
document.getElementById("p-aboutus-section-1").style.color = "white";
document.getElementById("h1-aboutus-section-2").style.color = "white";
document.getElementById("p-aboutus-section-2").style.color = "white";
document.querySelector(".big-circle").style.setProperty("---primary-contactus-circle-after-bg", "#212529");
}
}
const toggles = document.querySelectorAll(".faq-toggle");
toggles.forEach((toggle) => {
toggle.addEventListener("click", () => {
toggle.parentNode.classList.toggle("active");
});
});
//Cursor
const cursor = document.querySelector(".cursor");
document.addEventListener("mousemove", (e) => {
cursor.setAttribute("style", "top: " + (e.pageY - 10) + "px; left: " + (e.pageX - 10) + "px;");
});
document.addEventListener("click", () => {
cursor.classList.add("expand");
setTimeout(() => {
cursor.classList.remove("expand");
}, 500);
});
//Scroll-to -top
let mybutton = document.getElementById("myBtn");
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}