18 lines
510 B
JavaScript
18 lines
510 B
JavaScript
|
|
let tabs_select = () => {
|
|
const tabsContainer = document.getElementById("tabs")
|
|
if (!tabsContainer) {
|
|
return;
|
|
}
|
|
|
|
const buttons = tabsContainer.getElementsByClassName("switch__button")
|
|
for (const button of buttons) {
|
|
const value = button.getAttribute("data-value");
|
|
const id = button.getAttribute("id");
|
|
button.classList.toggle("active__button", value === id);
|
|
}
|
|
}
|
|
|
|
|
|
document.addEventListener('turbo:load', tabs_select)
|
|
console.log('Hi') |