25 lines
860 B
JavaScript
25 lines
860 B
JavaScript
document.addEventListener('DOMContentLoaded', function() {
|
|
// Tab functionality
|
|
const tabs = document.querySelectorAll('.tab');
|
|
const tabContents = document.querySelectorAll('.tab-content');
|
|
|
|
tabs.forEach(tab => {
|
|
tab.addEventListener('click', () => {
|
|
// Remove active class from all tabs
|
|
tabs.forEach(t => t.classList.remove('active'));
|
|
tabContents.forEach(content => content.style.display = 'none');
|
|
|
|
// Add active class to clicked tab
|
|
tab.classList.add('active');
|
|
|
|
// Show corresponding content
|
|
const targetId = tab.getAttribute('data-target');
|
|
document.getElementById(targetId).style.display = 'block';
|
|
});
|
|
});
|
|
|
|
// Initialize first tab as active
|
|
if (tabs.length > 0) {
|
|
tabs[0].click();
|
|
}
|
|
});
|