LiDa_Search/archive/script.js

19 lines
525 B
JavaScript
Raw Normal View History

2021-06-01 11:22:12 +02:00
const tabs = document.querySelector(".wrapper");
const tabButton = document.querySelectorAll(".tab-button");
const contents = document.querySelectorAll(".content");
tabs.onclick = e => {
const id = e.target.dataset.id;
if (id) {
tabButton.forEach(btn => {
btn.classList.remove("active");
});
e.target.classList.add("active");
contents.forEach(content => {
content.classList.remove("active");
});
const element = document.getElementById(id);
element.classList.add("active");
}
}