Skip to content

Commit

Permalink
some edits
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaHranovska committed Feb 12, 2024
1 parent 06538bd commit a72841e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/css/modal-window.css
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,8 @@
.modal-window {
width: 732px;
}

.exer-item {
gap: 30px;
}
}
35 changes: 35 additions & 0 deletions src/js/modal-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ closeIcon.addEventListener('click', closeModal)
function closeModal() {
backdrop.classList.add('is-open');
document.body.style.overflow = '';

clearModalContent();
}

// Завантаження сторінки
Expand Down Expand Up @@ -73,4 +75,37 @@ function getExercisesObject(id) {

})
.catch((err) => console.error(err));
}

// Очіщюємо вміст модалки після закриття

function clearModalContent() {
const refs = {
img: document.querySelector(".js-img"),
title: document.querySelector('.js-title'),
raiting: document.querySelector('.js-raiting'),
targetValue: document.querySelector('.js-target'),
bodyPartValue: document.querySelector('.js-body-part'),
equipmentValue: document.querySelector('.js-equipment'),
popularValue: document.querySelector('.js-popular'),
caloriesValue: document.querySelector('.js-calories'),
descriptionValue: document.querySelector('.js-description'),
};

// Встановлюємо пусті значення для всіх елементів модального вікна
refs.img.setAttribute('src', '');
refs.title.textContent = '';
refs.raiting.textContent = '';
refs.targetValue.textContent = '';
refs.bodyPartValue.textContent = '';
refs.equipmentValue.textContent = '';
refs.popularValue.textContent = '';
refs.caloriesValue.textContent = '';
refs.descriptionValue.textContent = '';

// Очищаємо класи зірок рейтингу
const stars = document.querySelectorAll('.raiting-item .icon-star');
stars.forEach(star => {
star.classList.add('non-activ');
});
}

0 comments on commit a72841e

Please sign in to comment.