RetroDECK-Website/scripts/features.js

20 lines
648 B
JavaScript
Raw Normal View History

2024-04-23 16:16:44 +00:00
featureTitles = document.getElementsByClassName('feature-list-item');
featureDetails = document.getElementsByClassName('feature-detail-container');
let currentFeature = 0;
for (let i = 0; i < featureTitles.length; i++) {
featureTitles[i].addEventListener('click', function () {
updateActiveFeature(i);
}, false)
}
function updateActiveFeature(i) {
currentFeature = i;
for (let j = 0; j < featureTitles.length; j++) {
featureTitles[j].removeAttribute('id');
featureDetails[j].removeAttribute('id');
}
featureTitles[i].id = 'active-feature-item';
featureDetails[i].id = 'active-feature-detail'
}