website/js/main.js

16 lines
519 B
JavaScript
Raw Normal View History

2023-11-17 14:35:12 +01:00
/* Menu Active Codes */
let targets = document.querySelectorAll('[data-target]')
targets.forEach(element => {
element.addEventListener('click', () => {
var target = document.querySelector(element.dataset.target)
targets.forEach(element2 => {
var target2 = document.querySelector(element2.dataset.target)
element2.style.color = 'var(--menu_text_color)'
target2.style.display = 'none'
});
element.style.color = 'var(--menu_active_text_color)'
target.style.display= 'flex'
})
})