feat: added step-by-step

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

16
assets/js/step-by-step.js Normal file
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');
}
});
});