From: Michael Tremer Date: Tue, 30 Dec 2025 16:20:15 +0000 (+0000) Subject: js: Support Bulma's tabs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f31c2b92dc4be1df5adce1a8a795c1cd21c51d51;p=ipfire.org.git js: Support Bulma's tabs Signed-off-by: Michael Tremer --- diff --git a/src/static/js/site.js b/src/static/js/site.js index 24ef831b..5c645b71 100644 --- a/src/static/js/site.js +++ b/src/static/js/site.js @@ -93,3 +93,24 @@ document.addEventListener("DOMContentLoaded", () => { } }); }); + +// Tabs +document.querySelectorAll(".tabs li").forEach(tab => { + tab.addEventListener("click", () => { + // Remove is-active from all tabs + document.querySelectorAll(".tabs li").forEach( + t => t.classList.remove("is-active") + ); + + // Hide all tab content + document.querySelectorAll(".tab-content").forEach( + c => c.classList.add("is-hidden") + ); + + // Activate the clicked tab + tab.classList.add('is-active') + + // Show the content + document.getElementById(tab.dataset.tab).classList.remove("is-hidden"); + }); +});