forked from Pjha72/Catchy-Beatz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
51 lines (39 loc) · 1.34 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
const body = document.querySelector("body"),
sidebar = body.querySelector(".sidebar"),
toggle = body.querySelector(".toggle"),
searchBtn = body.querySelector(".search-box"),
modeSwitch = body.querySelector(".toggle-switch"),
modeText = body.querySelector(".mode-text");
toggle.addEventListener("click", () => {
sidebar.classList.toggle("close");
});
searchBtn.addEventListener("click", () => {
sidebar.classList.remove("close");
});
modeSwitch.addEventListener("click", () => {
body.classList.toggle("dark");
if (body.classList.contains("dark")) {
modeText.innerText = "Light Mode"
} else {
modeText.innerText = "dark Mode"
}
});
// Search button from here
function myFunction() {
var input, filter, icons, figure, a, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
icons = document.getElementById("myICONS");
figure = myICONS.getElementsByClassName("card");
TEXT =myICONS.getElementsByClassName("text")
for (i = 0; i < figure.length; i++) {
a = figure[i].getElementsByClassName("card_title")[0];
txtValue = a.textContent || a.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
figure[i].style.display = "";
} else {
figure[i].style.display = "none";
// TEXT[i].style.display = "none";
}
}
}