-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
31 lines (29 loc) · 1.39 KB
/
main.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
var filterItems = document.querySelectorAll("ul li");
for (let i = 0; i < filterItems.length; i++) {
filterItems[i].addEventListener("click", function (e) {
if (e.target.classList.contains("clicked")) {
e.target.classList.remove("clicked");
var allResults = document.getElementsByClassName("card-panel");
for (let y = 0; y < allResults.length; y++) {
if (!allResults[y].classList.contains(filterItems[i].className)) {
// allResults[y].parentElement.classList.remove("animation");
allResults[y].parentElement.parentElement.style.display = "block";
}
}
}
else {
$("ul li").removeClass("clicked");
// $(".col").removeClass("animation");
$(".row").css("display", "none");
var allResults = document.getElementsByClassName("card-panel");
for (let y = 0; y < allResults.length; y++) {
// if (!allResults[y].classList.contains(filterItems[i].className)) {
// allResults[y].parentElement.classList.add("animation");
// // allResults[y].classList.add("animation");
// }
}
$(".row." + filterItems[i].className).css("display", "block");
e.target.classList.add("clicked");
}
});
}