kocandaci/static/js/personnel.js

18 lines
534 B
JavaScript
Raw Normal View History

2024-01-11 19:25:02 +01:00
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");
}
});
});
});