diff --git a/index.html b/index.html index ae83196..c49f32c 100644 --- a/index.html +++ b/index.html @@ -341,11 +341,11 @@ - - @@ -420,7 +420,7 @@ integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"> - + diff --git a/scripts/features.js b/scripts/features.js index 25aba1f..2dff533 100644 --- a/scripts/features.js +++ b/scripts/features.js @@ -1,38 +1,49 @@ -const featureContainerElems = document.getElementsByClassName('feature-container'); -let currentFeature = 1 +// const featureContainerElems = document.getElementsByClassName('feature-container'); +// let currentFeature = 1 -for (let i = 0; i < featureContainerElems.length; i++) { - featureContainerElems[i].addEventListener('click', function() { - if (i != currentFeature) { - updateActiveFeature(i); - } - }) -} +// for (let i = 0; i < featureContainerElems.length; i++) { +// featureContainerElems[i].addEventListener('click', function() { +// if (i != currentFeature) { +// updateActiveFeature(i); +// } +// }) +// } -document.addEventListener('keyup', keyControl); +// document.addEventListener('keyup', keyControl); -function keyControl(e) { +// function keyControl(e) { +// if (e.code == 'ArrowRight') { +// if (currentFeature < featureContainerElems.length-2) { +// updateActiveFeature(currentFeature + 1); +// } else { +// updateActiveFeature(1); +// } +// } +// if (e.code == 'ArrowLeft') { +// if (currentFeature > 1) { +// updateActiveFeature(currentFeature - 1); +// } else { +// updateActiveFeature(featureContainerElems.length-2); +// } +// } +// } + +// function updateActiveFeature(i) { +// const lastCurrentFeature = currentFeature; +// currentFeature = i; + +// featureContainerElems[i].id = 'active-feature'; +// featureContainerElems[i].scrollIntoView({block: 'start', inline: 'center'}); +// featureContainerElems[lastCurrentFeature].id = '' +// } + + +document.addEventListener('keyup', function(e) { if (e.code == 'ArrowRight') { - if (currentFeature < featureContainerElems.length-2) { - updateActiveFeature(currentFeature + 1); - } else { - updateActiveFeature(1); - } + document.getElementById('carousel-next').click(); + document.getElementById('features').scrollIntoView({block: 'center'}); + } else if (e.code == 'ArrowLeft') { + document.getElementById('carousel-prev').click(); + document.getElementById('features').scrollIntoView({block: 'center'}); } - if (e.code == 'ArrowLeft') { - if (currentFeature > 1) { - updateActiveFeature(currentFeature - 1); - } else { - updateActiveFeature(featureContainerElems.length-2); - } - } -} - -function updateActiveFeature(i) { - const lastCurrentFeature = currentFeature; - currentFeature = i; - - featureContainerElems[i].id = 'active-feature'; - featureContainerElems[i].scrollIntoView({block: 'start', inline: 'center'}); - featureContainerElems[lastCurrentFeature].id = '' -} \ No newline at end of file +}); \ No newline at end of file