forked from Apoorv-cloud/1_Hacktoberfest-22
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (22 loc) · 772 Bytes
/
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
function searchPlaylist() {
var filter_text = document.getElementById("search_bar").value.toUpperCase();
var card = document.getElementsByClassName("card");
for (var i = 0; i < card.length; i++) {
var title = card[i].getElementsByClassName("title")[0];
var str = title.innerText || title.textContent;
if (str.toUpperCase().indexOf(filter_text) > -1) {
card[i].style.display = "";
} else {
card[i].style.display = "none";
}
}
}
// gotopbutton
const gotopbtn = document.querySelector(".gotopbtn");
window.addEventListener("scroll", () => {
if (window.pageYOffset > 100) {
gotopbtn.classList.add("active");
} else {
gotopbtn.classList.remove("active")
}
});