|
|
|
@ -216,6 +216,41 @@ btnOpenSearchPhone.onclick = function () { |
|
|
|
|
|
|
|
|
|
// search end
|
|
|
|
|
|
|
|
|
|
// open-modal
|
|
|
|
|
|
|
|
|
|
let openModals = document.querySelectorAll('.open-modal'), |
|
|
|
|
modal = document.querySelector('.modal'); |
|
|
|
|
|
|
|
|
|
openModals.forEach(openModal => { |
|
|
|
|
let modalName = openModal.dataset.modal; |
|
|
|
|
|
|
|
|
|
openModal.onclick = function () { |
|
|
|
|
let modalItem = document.querySelector(`.modal__item.${modalName}`); |
|
|
|
|
|
|
|
|
|
modalItem.classList.add('active'); |
|
|
|
|
modal.classList.add('active'); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
modal.onclick = function (event) { |
|
|
|
|
if (event.srcElement.classList.contains('modal')) { |
|
|
|
|
document.querySelector(`.modal__item.active`).classList.remove('active'); |
|
|
|
|
modal.classList.remove('active'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let itemModels = document.querySelectorAll('.modal__item'); |
|
|
|
|
|
|
|
|
|
itemModels.forEach(item => { |
|
|
|
|
let btnClose = item.querySelector('.modal-item__close'); |
|
|
|
|
|
|
|
|
|
btnClose.onclick = function () { |
|
|
|
|
item.classList.remove('active'); |
|
|
|
|
modal.classList.remove('active'); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// open-modal end
|
|
|
|
|
|
|
|
|
|
// resize
|
|
|
|
|
window.addEventListener('resize', () => { |
|
|
|
|
let screenWidth = window.screen.width; |
|
|
|
|