mirror of
https://github.com/RetroDECK/RetroDECK-Website.git
synced 2024-11-22 06:55:37 +00:00
20 lines
648 B
JavaScript
20 lines
648 B
JavaScript
|
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'
|
||
|
}
|