Filtr nástrojů
parent
a6e079f240
commit
a43e4522d9
@ -0,0 +1,19 @@
|
||||
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";
|
||||
});
|
||||
}
|
Reference in New Issue