document.addEventListener("DOMContentLoaded", function () {
function activateTabByHash() {
const hash = window.location.hash.replace("#", "");
if (!hash) return;
const tabButton = document.getElementById(hash);
if (!tabButton) return;
const tabsWrapper = tabButton.closest(".e-n-tabs");
if (!tabsWrapper) return;
const allTabs = tabsWrapper.querySelectorAll(".e-n-tab-title");
const allPanels = tabsWrapper.querySelectorAll('[role="tabpanel"]');
// Reset tabs
allTabs.forEach(tab => {
tab.setAttribute("aria-selected", "false");
tab.setAttribute("tabindex", "-1");
tab.classList.remove("e-active");
});
// Reset panels
allPanels.forEach(panel => {
panel.classList.remove("e-active");
panel.style.display = "none";
});
// Activate current tab
tabButton.setAttribute("aria-selected", "true");
tabButton.setAttribute("tabindex", "0");
tabButton.classList.add("e-active");
// Show content
const panelId = tabButton.getAttribute("aria-controls");
const panel = document.getElementById(panelId);
if (panel) {
panel.classList.add("e-active");
panel.style.display = "block";
}
// Scroll về khu vực tab (optional)
tabButton.scrollIntoView({
behavior: "smooth",
block: "nearest"
});
}
// Run on load
setTimeout(activateTabByHash, 300);
// Run when hash changes (nếu copy link khi đang ở page)
window.addEventListener("hashchange", activateTabByHash);
});



























































