feat: добавлена современная страница деталей услуги с портфолио и отзывами
This commit is contained in:
60
smartsoltech/static/assets/js/force-unblock.js
Normal file
60
smartsoltech/static/assets/js/force-unblock.js
Normal file
@@ -0,0 +1,60 @@
|
||||
// Force unblock - агрессивная очистка блокирующих элементов
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function forceUnblock() {
|
||||
console.log('ForceUnblock: Starting cleanup...');
|
||||
|
||||
// Удаляем loading screen
|
||||
const loadingScreen = document.getElementById('loading-screen');
|
||||
if (loadingScreen) {
|
||||
loadingScreen.remove();
|
||||
console.log('ForceUnblock: Loading screen removed');
|
||||
}
|
||||
|
||||
// Убираем modal-open с body
|
||||
document.body.classList.remove('modal-open');
|
||||
document.body.style.overflow = '';
|
||||
document.body.style.paddingRight = '';
|
||||
console.log('ForceUnblock: Body cleaned');
|
||||
|
||||
// Закрываем все модальные окна
|
||||
document.querySelectorAll('.modal').forEach(modal => {
|
||||
modal.classList.remove('show');
|
||||
modal.style.display = 'none';
|
||||
modal.setAttribute('aria-hidden', 'true');
|
||||
modal.removeAttribute('aria-modal');
|
||||
});
|
||||
console.log('ForceUnblock: Modals closed');
|
||||
|
||||
// Удаляем все backdrop элементы
|
||||
document.querySelectorAll('.modal-backdrop').forEach(backdrop => {
|
||||
backdrop.remove();
|
||||
});
|
||||
console.log('ForceUnblock: Backdrops removed');
|
||||
|
||||
// Убираем pointer-events: none с всех элементов кроме скрытых модалов
|
||||
document.querySelectorAll('[style*="pointer-events"]').forEach(el => {
|
||||
if (!el.classList.contains('modal') || !el.classList.contains('show')) {
|
||||
el.style.pointerEvents = '';
|
||||
}
|
||||
});
|
||||
console.log('ForceUnblock: Pointer events cleaned');
|
||||
|
||||
// Проверяем, что body кликабельно
|
||||
document.body.style.pointerEvents = 'auto';
|
||||
|
||||
console.log('ForceUnblock: Cleanup complete!');
|
||||
}
|
||||
|
||||
// Выполняем сразу
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', forceUnblock);
|
||||
} else {
|
||||
forceUnblock();
|
||||
}
|
||||
|
||||
// И еще раз через небольшую задержку для надежности
|
||||
setTimeout(forceUnblock, 100);
|
||||
setTimeout(forceUnblock, 500);
|
||||
})();
|
||||
@@ -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