Menu lateral
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const menuButtons = document.querySelectorAll('.menu-btn');
|
||||
const sections = document.querySelectorAll('.section');
|
||||
const sectionTitle = document.getElementById('section-title');
|
||||
|
||||
const titles = {
|
||||
trabajadores: 'Trabajadores',
|
||||
nominas: 'Nóminas',
|
||||
liquidaciones: 'Liquidaciones',
|
||||
licencia: 'Licencia'
|
||||
};
|
||||
|
||||
menuButtons.forEach(button => {
|
||||
button.addEventListener('click', function () {
|
||||
const target = this.dataset.section;
|
||||
|
||||
menuButtons.forEach(btn => btn.classList.remove('active'));
|
||||
this.classList.add('active');
|
||||
|
||||
sections.forEach(section => section.classList.remove('active'));
|
||||
document.getElementById(target).classList.add('active');
|
||||
|
||||
sectionTitle.textContent = titles[target] || '';
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user