Skip to main content

max / makenotwork

890 B · 19 lines History Blame Raw
1 function switchSectionTab(btn, panelId) {
2 // Tab selection uses .is-selected (charter); panel visibility
3 // still uses .active (display: none/block toggle).
4 document.querySelectorAll('.project-sections .section-tab').forEach(function(t) { t.classList.remove('is-selected'); });
5 document.querySelectorAll('.project-sections .section-panel').forEach(function(p) { p.classList.remove('active'); });
6 btn.classList.add('is-selected');
7 var panel = document.getElementById(panelId);
8 if (panel) panel.classList.add('active');
9 history.replaceState(null, '', '#' + panelId);
10 }
11 (function() {
12 var hash = window.location.hash.replace('#', '');
13 if (hash) {
14 var panel = document.getElementById(hash);
15 var tab = document.querySelector('.project-sections [data-tab="' + hash + '"]');
16 if (panel && tab) switchSectionTab(tab, hash);
17 }
18 })();
19