feat: added step-by-step

This commit is contained in:
Aliaksei Karzhou committed 2024-07-02 19:29:42 +03:00
1 parent 32e6628824
commit 01fc9d9edd
11 files changed
+520 -15

No files matched your search

+1
View File
@@ -1 +1,2 @@
import './sliders.js';
import './step-by-step.js';
+16
View File
@@ -0,0 +1,16 @@
const stepByStepButtons = document.querySelectorAll('.step-by-step__controls-button');
const stepByStepCards = document.querySelectorAll('.step-by-step__card');
const stepByStepContent = document.querySelector('.step-by-step__content');
stepByStepButtons.forEach((button) => {
button.addEventListener('click', (event) => {
const targetId = event.currentTarget.dataset.target;
const targetCard = document.getElementById(targetId);
if (targetCard) {
stepByStepButtons.forEach((buttonElem) => buttonElem.classList.remove('active'));
stepByStepCards.forEach((card) => card.classList.remove('active'));
event.currentTarget.classList.add('active');
targetCard.classList.add('active');
}
});
});