feat: добавлена современная страница деталей услуги с портфолио и отзывами
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
// Работа с модальным окном заявки
|
||||
// Функция для закрытия всех модальных окон
|
||||
function closeAllModals() {
|
||||
document.querySelectorAll('.modal').forEach(modal => {
|
||||
modal.classList.remove('show');
|
||||
modal.style.display = 'none';
|
||||
});
|
||||
document.body.classList.remove('modal-open');
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
|
||||
// Закрыть все модальные окна при загрузке страницы
|
||||
closeAllModals();
|
||||
|
||||
// Работа с модальным окном заявки (Bootstrap modal)
|
||||
var modalElement = document.getElementById('orderModal');
|
||||
if (modalElement) {
|
||||
var modal = new bootstrap.Modal(modalElement);
|
||||
@@ -14,9 +27,10 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
}
|
||||
|
||||
// Открытие модального окна для заявки на услугу
|
||||
// Открытие кастомного модального окна для заявки на услугу
|
||||
const openModalBtn = document.getElementById('openModalBtn');
|
||||
const serviceModal = document.getElementById('serviceModal');
|
||||
const generateQrButton = document.getElementById('generateQrButton');
|
||||
|
||||
if (openModalBtn && serviceModal) {
|
||||
openModalBtn.addEventListener('click', function (event) {
|
||||
@@ -29,21 +43,36 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
return;
|
||||
}
|
||||
|
||||
generateQrButton.dataset.serviceId = serviceId;
|
||||
if (generateQrButton) {
|
||||
generateQrButton.dataset.serviceId = serviceId;
|
||||
}
|
||||
|
||||
serviceModal.classList.add('show');
|
||||
serviceModal.style.display = 'block';
|
||||
document.body.classList.add('modal-open');
|
||||
document.body.style.overflow = 'hidden';
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelectorAll('.close').forEach(closeBtn => {
|
||||
// Закрытие кастомного модального окна
|
||||
const closeButtons = document.querySelectorAll('.close');
|
||||
closeButtons.forEach(closeBtn => {
|
||||
closeBtn.addEventListener('click', function () {
|
||||
if (serviceModal) {
|
||||
serviceModal.classList.remove('show');
|
||||
setTimeout(() => {
|
||||
serviceModal.style.display = 'none';
|
||||
}, 500);
|
||||
}
|
||||
closeAllModals();
|
||||
});
|
||||
});
|
||||
|
||||
// Закрытие модального окна при клике вне его
|
||||
window.addEventListener('click', function (event) {
|
||||
if (event.target.classList.contains('modal') && event.target.classList.contains('show')) {
|
||||
closeAllModals();
|
||||
}
|
||||
});
|
||||
|
||||
// Закрытие по нажатию Escape
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Escape') {
|
||||
closeAllModals();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user