You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
640 B
JavaScript
20 lines
640 B
JavaScript
filterSelection("all");
|
|
function filterSelection(c) {
|
|
var x = document.getElementsByClassName("program");
|
|
if (c == "all") c = "";
|
|
for (var i = 0; i < x.length; i++) {
|
|
x[i].classList.remove("show");
|
|
if (x[i].className.indexOf(c) >= 0) x[i].classList.add("show");
|
|
}
|
|
}
|
|
|
|
var btnContainer = document.getElementById("filters");
|
|
var btns = btnContainer.getElementsByClassName("btn");
|
|
for (var i = 0; i < btns.length; i++) {
|
|
btns[i].addEventListener("click", function() {
|
|
var current = document.getElementsByClassName("active");
|
|
current[0].className = current[0].className.replace(" active", "");
|
|
this.className += " active";
|
|
});
|
|
}
|