kocandaci/static/js/personnel.js
2024-01-11 19:33:16 +01:00

18 lines
534 B
JavaScript

let people = Array.from(document.getElementsByClassName("person"));
let buttons = Array.from(document.getElementsByClassName("button"));
buttons.forEach(button => {
button.addEventListener("click", function() {
buttons.forEach(button => {
button.classList.remove("active");
});
button.classList.add("active");
people.forEach(person => {
person.classList.remove("hidden");
if (button.dataset.value != 0 && !person.dataset.beh.includes(button.dataset.value)) {
person.classList.add("hidden");
}
});
});
});