Мягкая мебель из коллекции СТУГЛ 120х60х75 см
setTimeout(function () {
const widget = document.querySelector('.widget');
widget.style.opacity = '1';
}, 100);
function toggleDarkOverlay() {
document.body.classList.toggle('dark-overlay', firstList.classList.contains('active') || secondList.classList.contains('active') || popupFormCatalog.classList.contains('active') || popupFormTz.classList.contains('active') || popupFormPartner.classList.contains('active') || popupFormSpecialist.classList.contains('active'));
}
function closeForms() {
firstList.classList.remove('active');
secondList.classList.remove('active');
popupFormCatalog.classList.remove('active');
popupFormTz.classList.remove('active');
popupFormPartner.classList.remove('active');
popupFormSpecialist.classList.remove('active');
buttons.forEach(button => button.classList.remove('active'));
toggleDarkOverlay();
}
function addFormListeners(form) {
form.addEventListener('click', function (event) {
event.stopPropagation();
});
document.addEventListener('click', function (event) {
const isClickInsideWidget = widget.contains(event.target);
const isFormActive = form.classList.contains('active');
const isPopupActive = event.target.closest('.b24-window-popup');
if (!isClickInsideWidget && !isFormActive && !isPopupActive) {
closeForms();
}
});
}
addFormListeners(popupFormCatalog);
addFormListeners(popupFormTz);
addFormListeners(popupFormPartner);
addFormListeners(popupFormSpecialist);
document.addEventListener('click', function (event) {
const isClickInsideWidget = widget.contains(event.target);
const isSecondModalActive = popupFormTz.classList.contains('active') ||
popupFormPartner.classList.contains('active') ||
popupFormSpecialist.classList.contains('active');
const isPopupActive = event.target.closest('.b24-window-popup');
if (!isClickInsideWidget && !isSecondModalActive && !isPopupActive) {
closeForms();
}
});
buttons.forEach(button => {
button.addEventListener('click', function () {
const isActive = button.classList.contains('active');
buttons.forEach(btn => btn.classList.remove('active'));
if (!isActive) {
button.classList.add('active');
if (button.textContent.trim() === 'Связь с нами') {
secondList.classList.add('active');
firstList.classList.remove('active');
popupFormCatalog.classList.remove('active');
popupFormTz.classList.remove('active');
popupFormPartner.classList.remove('active');
popupFormSpecialist.classList.remove('active');
toggleDarkOverlay();
} else if (button.textContent.trim() === 'Меню') {
firstList.classList.add('active');
secondList.classList.remove('active');
popupFormCatalog.classList.remove('active');
popupFormTz.classList.remove('active');
popupFormPartner.classList.remove('active');
popupFormSpecialist.classList.remove('active');
toggleDarkOverlay();
}
} else {
firstList.classList.remove('active');
secondList.classList.remove('active');
popupFormCatalog.classList.remove('active');
popupFormTz.classList.remove('active');
popupFormPartner.classList.remove('active');
popupFormSpecialist.classList.remove('active');
toggleDarkOverlay();
}
});
});
changingButton.addEventListener('click', function () {
if (firstList.classList.contains('active')) {
firstList.classList.remove('active');
popupFormCatalog.classList.remove('active');
popupFormTz.classList.remove('active');
popupFormPartner.classList.remove('active');
popupFormSpecialist.classList.remove('active');
toggleDarkOverlay();
} else {
firstList.classList.add('active');
secondList.classList.remove('active');
popupFormCatalog.classList.remove('active');
popupFormTz.classList.remove('active');
popupFormPartner.classList.remove('active');
popupFormSpecialist.classList.remove('active');
toggleDarkOverlay();
}
});
const catalogLink = document.querySelector('.widget-first_list-item[href="catalog"]');
catalogLink.addEventListener('click', function (event) {
event.preventDefault();
popupFormCatalog.classList.add('active');
firstList.classList.remove('active');
toggleDarkOverlay();
});
const tzLink = document.querySelector('.widget-first_list-item[href="tz"]');
tzLink.addEventListener('click', function (event) {
event.preventDefault();
popupFormTz.classList.add('active');
firstList.classList.remove('active');
toggleDarkOverlay();
});
const partnerLink = document.querySelector('.widget-first_list-item[href="partner"]');
partnerLink.addEventListener('click', function (event) {
event.preventDefault();
popupFormPartner.classList.add('active');
firstList.classList.remove('active');
toggleDarkOverlay();
});
const specialistLink = document.querySelector('.widget-first_list-item[href="specialist"]');
specialistLink.addEventListener('click', function (event) {
event.preventDefault();
popupFormSpecialist.classList.add('active');
firstList.classList.remove('active');
toggleDarkOverlay();
});
});
-->