diff --git a/docs/index.html b/docs/index.html index 53b4b93..f0aedf9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,6 +8,21 @@ SoftwareManager - Main + + + + + + + + + + + + + + + @@ -195,7 +210,12 @@ tablinks[i].className = tablinks[i].className.replace(" active", ""); } - document.getElementById(tabName).style.display = "block"; + var target = document.getElementById(tabName); + target.style.display = "block"; + // restart animation + target.classList.remove('tab-animate'); + void target.offsetWidth; + target.classList.add('tab-animate'); let activeButton = document.querySelector(`.tablinks[onclick*="${tabName}"]`); if (activeButton) { @@ -219,6 +239,17 @@ } }); + // Determine the correct tab immediately (before full load) to prevent flash + (function() { + let currentPath = window.location.pathname; + let tabName = 'start'; + if (currentPath === '/api') tabName = 'api'; + else if (currentPath === '/docs') tabName = 'docs'; + else if (currentPath !== '/') tabName = 'notfound'; + // Show only the correct tab right away + document.getElementById(tabName).style.display = 'block'; + })(); + window.onload = function() { let currentPath = window.location.pathname; diff --git a/docs/main.css b/docs/main.css index f2b88a7..f9760b2 100644 --- a/docs/main.css +++ b/docs/main.css @@ -65,6 +65,27 @@ main { padding: 3rem; } +/* Hide all tabs by default to prevent flash on page load */ +.tabcontent { + display: none; +} + +/* Tab switch animation */ +@keyframes tabFadeIn { + from { + opacity: 0; + transform: translateY(8px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +.tabcontent.tab-animate { + animation: tabFadeIn 0.3s ease-out forwards; +} + main h1.hometitle { font-size: 4.0rem; line-height: 4rem;