You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
734 B
16 lines
734 B
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');
|
|
}
|
|
});
|
|
});
|
|
|