mirror of
https://github.com/RetroDECK/RetroDECK-Website.git
synced 2024-11-21 14:35:38 +00:00
Performance improvements to features selector
This commit is contained in:
parent
b8183ae21a
commit
12093d0551
|
@ -73,6 +73,11 @@ footer {
|
|||
padding: 0.5rem;
|
||||
cursor: pointer;
|
||||
background: #333;
|
||||
border: 1px transparent solid;
|
||||
}
|
||||
|
||||
#active-feature-item {
|
||||
border: 1px white solid;
|
||||
}
|
||||
|
||||
.feature-detail-container {
|
||||
|
@ -81,12 +86,4 @@ footer {
|
|||
|
||||
#active-feature-detail {
|
||||
display: inherit;
|
||||
}
|
||||
|
||||
.feature-list-item {
|
||||
border: 1px transparent solid;
|
||||
}
|
||||
|
||||
#active-feature-item {
|
||||
border: 1px white solid;
|
||||
}
|
||||
}
|
|
@ -178,8 +178,7 @@
|
|||
<!-- Right Column -->
|
||||
<div class="col-8" id="feature-detail-column">
|
||||
<div class="my-gradient gradient-spin rounded-3">
|
||||
<div class="feature-detail-container rounded-3 p-3"
|
||||
id="active-feature-detail">
|
||||
<div class="feature-detail-container rounded-3 p-3" id="active-feature-detail">
|
||||
<!-- Image/Video Container -->
|
||||
<div class="row" id="feature-media-container">
|
||||
<div class="col">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
featureTitles = document.getElementsByClassName('feature-list-item');
|
||||
featureDetails = document.getElementsByClassName('feature-detail-container');
|
||||
// let currentFeature = 0;
|
||||
const featureTitles = document.getElementsByClassName('feature-list-item');
|
||||
const featureDetails = document.getElementsByClassName('feature-detail-container');
|
||||
let currentFeature = 0;
|
||||
|
||||
for (let i = 0; i < featureTitles.length; i++) {
|
||||
featureTitles[i].addEventListener('click', function () {
|
||||
|
@ -12,20 +12,18 @@ for (let i = 0; i < featureTitles.length; i++) {
|
|||
}
|
||||
|
||||
function updateActiveFeature(i) {
|
||||
// Reset all
|
||||
for (let j = 0; j < featureTitles.length; j++) {
|
||||
featureTitles[j].removeAttribute('id');
|
||||
featureDetails[j].removeAttribute('id');
|
||||
featureTitles[j].className = 'row feature-list-item rounded-3';
|
||||
featureTitles[j].style = '';
|
||||
}
|
||||
const lastCurrentFeature = currentFeature;
|
||||
currentFeature = i;
|
||||
|
||||
// currentFeature = i;
|
||||
// New current feature
|
||||
featureTitles[currentFeature].className += ' gradient-spin my-gradient';
|
||||
featureTitles[currentFeature].id = 'active-feature-item';
|
||||
featureDetails[currentFeature].id = 'active-feature-detail'
|
||||
|
||||
// Update the active feature
|
||||
featureTitles[i].id = 'active-feature-item';
|
||||
featureDetails[i].id = 'active-feature-detail'
|
||||
// Reset previous current feature
|
||||
featureTitles[lastCurrentFeature].removeAttribute('id');
|
||||
featureTitles[lastCurrentFeature].className = 'row feature-list-item rounded-3';
|
||||
featureTitles[lastCurrentFeature].style = '';
|
||||
featureDetails[lastCurrentFeature].removeAttribute('id');
|
||||
|
||||
// Handle styles
|
||||
featureTitles[i].className += ' gradient-spin my-gradient';
|
||||
}
|
Loading…
Reference in a new issue