forked from mdmusaibali/BooksVilla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
63 lines (57 loc) · 2.08 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
57
58
59
60
61
62
63
const closeButton = document.querySelector(".close-icon");
const body = document.querySelector("body");
const helpButton = document.querySelector(".sticky");
const helpForm = document.querySelector(".help-form");
const cancelButton = document.querySelector(".cancel");
const upwardsButton = document.querySelector(".sticktobottom");
const downloadButtons = document.querySelectorAll(".btn").forEach((btn) =>
btn.addEventListener("click", function () {
alert(
"It may take 5-10 seconds for the download to start.\nPress OK to confirm"
);
})
);
//------------------------------------------------------------------------------------
const box = document.querySelectorAll(".box");
const downArrow = document.querySelectorAll(".down-arrow");
const upArrow = document.querySelectorAll(".up-arrow");
const trigger = document.querySelectorAll(".trigger");
for (let i = 0; i < trigger.length; i++) {
trigger[i].addEventListener("click", function () {
box[i].classList.toggle("hide");
box[i].classList.toggle("unhide");
downArrow[i].classList.toggle("hidden");
upArrow[i].classList.toggle("hidden");
});
}
helpButton.addEventListener("click", function () {
document.documentElement.scrollTop = 0;
cancelButton.classList.toggle("hidden");
helpButton.classList.toggle("hidden");
helpForm.classList.toggle("help-form-transform");
});
cancelButton.addEventListener("click", function () {
cancelButton.classList.toggle("hidden");
helpButton.classList.toggle("hidden");
helpForm.classList.remove("help-form-transform");
});
upwardsButton.addEventListener("click", function () {
document.documentElement.scrollTop = 0;
});
//Counter------------------------------------------------
const counter = document.querySelector(".countNum");
var count;
function clicked() {
var xhr = new XMLHttpRequest();
xhr.open(
"GET",
"https://api.countapi.xyz/update/mdmusaibalibooksvilla.com/mdmusaibalibooksvilla.com?amount=1"
);
xhr.responseType = "json";
xhr.onload = function () {
count = this.response.value;
counter.textContent = count;
};
xhr.send();
}
clicked();