//Header openCatalog(); // кнопка каталог в header concatcUs(); // кнопка Заказать звонок chooseCity(); // выбрать город modalAuth(); // авторизация modalRestorePass(); // восстановить пароль modalRestorePassSuccess(); //восстановить пароль - успешно modalRestoreError(); // восстановить пароль - ошибка modalReg(); // регистрация //Footer footerSpoiler(); // спойлер моб версия //Главная страница swiperMain(); // swiper главная страница первый экран swiperCatalog(); // swiper главная страница каталог catalogTabsHandler(); // переключатель табов каталога catalogButtonsHandler(); // в разделе каталог добавление в избранное и сравнить swiperMachines(); // swiper раздел Machines swiperPartners(); // swiper раздел Нам доверяют cookiePopup(); // показ Куки //Страница Карточка товара productPageSwiper(); // swiper первый экран productTabs(); // табы с описанием товара offerSwiper(); // swiper Выгодное предложение swiperProjects(); // swiper Реализованные проекты swiperViewed(); // swiper Недавно просматривали swiperModels(); // swiper Образцы изделей таб-3 telefonMask(); // маска телефона в форме swiperTab5(); // swiper Аксуссуары таб-5 swiperTab6(); // swiper Оснастка таб-6 swiperTab7(); // swiper Похожая техника таб-7 addToCart(); // открыть модальное окно Товар добален в корзину getConsult(); // открыть модальное окно - Заказать консультацию // initMap(); // яндекс карта //Модальное окно - Карточка товара кратко modalProductTabs(); // переключение табов modalViewed(); // раздел Недавно просматривали //Модальные окна orderParts(); // Модальное окно - Заказать запчасти addedToCart(); // настройка модального окна - Товар добавлен в корзину //Страница поиск результат resultPagination(); //Страница каталог toggleList(); // выподающий список toogleSorting(); // сортировка swiperArticles(); // swiper раздел Статьи по разделу swiperReviews(); // swiper Отзывы партнеров //Страница о компании swiperHistory(); // swiper история развития //Header function openCatalog() { const catalogBtn = document.querySelector('.js-catalog-btn'); if (catalogBtn) { catalogBtn.addEventListener('click', (e) => { e.preventDefault(); catalogBtn.classList.toggle('catalog-open'); }); } } function concatcUs() { const openModalLink = document.querySelector('.js_header_button_call'); const closeModalBtn = document.querySelector('.js_modal_contact_close'); const modal = document.querySelector('.js_modal_contact'); const overlay = document.querySelector('.js_modal_contact_overlay'); const openModal = function () { modal.classList.remove('modal-contact--hidden'); overlay.classList.remove('modal-contact-overlay--hidden'); document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-contact--hidden'); overlay.classList.add('modal-contact-overlay--hidden'); document.body.style.overflow = null; }; if (openModalLink) { openModalLink.addEventListener('click', openModal); } if (closeModalBtn) { closeModalBtn.addEventListener('click', closeModal); } } function chooseCity() { const openModalBtn = document.querySelector('.js_city_choose'); const closeModalBtn = document.querySelector('.js_modal_city_close'); const modal = document.querySelector('.js_modal_city'); const overlay = document.querySelector('.js_modal_city_overlay'); let cities = document.querySelectorAll('.js_city_item'); const openModal = function () { modal.classList.remove('modal-city--hidden'); overlay.classList.remove('modal-city-overlay--hidden'); // document.body.style.overflow = 'hidden'; openModalBtn.classList.add('header-up-left__city--active'); }; const closeModal = function () { modal.classList.add('modal-city--hidden'); overlay.classList.add('modal-city-overlay--hidden'); // document.body.style.overflow = null; openModalBtn.classList.remove('header-up-left__city--active'); }; cities.forEach((city) => { city.addEventListener('click', (e) => { e.preventDefault(); let currentCity = city; if (!currentCity.classList.contains('city-main__item--active')) { cities.forEach((city) => { city.classList.remove('city-main__item--active'); }); currentCity.classList.add('city-main__item--active'); openModalBtn.innerHTML = currentCity.innerText; closeModal(); } }); }); if (openModalBtn) { openModalBtn.addEventListener('click', openModal); } if (closeModalBtn) { closeModalBtn.addEventListener('click', closeModal); } document.addEventListener('keydown', function (event) { if (event.code === 'Escape' && !modal.classList.contains('modal-city--hidden')) { closeModal(); } }); } function modalAuth() { const openModalLink = document.querySelector('.js_header_entry'); const closeModalBtn = document.querySelector('.js_modal_auth_close'); const modal = document.querySelector('.js_modal_auth'); const overlay = document.querySelector('.js_modal_auth_overlay'); const passwordField = document.querySelector('.js_auth_pass'); const showPasswordBtn = document.querySelector('.js_auth_show_pass'); const openRestoreLink = document.querySelector('.js_restore_pass'); const openModal = function () { modal.classList.remove('modal-auth--hidden'); overlay.classList.remove('modal-auth-overlay--hidden'); document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-auth--hidden'); overlay.classList.add('modal-auth-overlay--hidden'); document.body.style.overflow = null; }; if (openModalLink) { openModalLink.addEventListener('click', openModal); } if (closeModalBtn || openRestoreLink) { closeModalBtn.addEventListener('click', closeModal); openRestoreLink.addEventListener('click', closeModal); } document.addEventListener('keydown', function (event) { if (event.code === 'Escape' && !modal.classList.contains('modal-auth--hidden')) { closeModal(); } }); if (showPasswordBtn) { showPasswordBtn.addEventListener('click', function () { if (passwordField.type === 'password') { passwordField.type = 'text'; } else { passwordField.type = 'password'; } }); } } function modalRestorePass() { const openModalLink = document.querySelector('.js_restore_pass'); const closeModalBtn = document.querySelector('.js_modal_restore_close'); const closeModalInner = document.querySelector('.js_restore_back'); const modal = document.querySelector('.js_modal_restore'); const overlay = document.querySelector('.js_modal_restore_overlay'); const openModal = function () { modal.classList.remove('modal-restore--hidden'); overlay.classList.remove('modal-restore-overlay--hidden'); document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-restore--hidden'); overlay.classList.add('modal-restore-overlay--hidden'); document.body.style.overflow = null; }; if (openModalLink) { openModalLink.addEventListener('click', openModal); } if (closeModalBtn || closeModalInner) { closeModalBtn.addEventListener('click', closeModal); closeModalInner.addEventListener('click', closeModal); } document.addEventListener('keydown', function (event) { if (event.code === 'Escape' && !modal.classList.contains('modal-restore--hidden')) { closeModal(); } }); } function modalRestorePassSuccess() { // const openModalLink = document.querySelector(''); const closeModalBtn = document.querySelector('.js_modal_restore_succ_close'); const closeModalInner = document.querySelector('.js_res_succ_ok'); const closeModalInnerBack = document.querySelector('.js_res_succ_back'); const modal = document.querySelector('.js_modal_restore_succ'); const overlay = document.querySelector('.js_modal_restore_succ_overlay'); const openModal = function () { modal.classList.remove('modal-restore-succ--hidden'); overlay.classList.remove('modal-restore-succ-overlay--hidden'); document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-restore-succ--hidden'); overlay.classList.add('modal-restore-succ-overlay--hidden'); document.body.style.overflow = null; }; // if (openModalLink) { // openModalLink.addEventListener('click', openModal); // } if (closeModalBtn || closeModalInner || closeModalInnerBack) { closeModalBtn.addEventListener('click', closeModal); closeModalInner.addEventListener('click', closeModal); closeModalInnerBack.addEventListener('click', closeModal); } document.addEventListener('keydown', function (event) { if (event.code === 'Escape' && !modal.classList.contains('modal-restore-succ--hidden')) { closeModal(); } }); } function modalRestoreError() { // const openModalLink = document.querySelector('.js_test'); const closeModalBtn = document.querySelector('.js_modal_restore_error_close'); const closeModalInnerBack = document.querySelector('.js_restore_error_back'); const modal = document.querySelector('.js_modal_restore_error'); const overlay = document.querySelector('.js_modal_restore_error_overlay'); const openModal = function () { modal.classList.remove('modal-restore-error--hidden'); overlay.classList.remove('modal-restore-error-overlay--hidden'); document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-restore-error--hidden'); overlay.classList.add('modal-restore-error-overlay--hidden'); document.body.style.overflow = null; }; // if (openModalLink) { // openModalLink.addEventListener('click', openModal); // } if (closeModalBtn || closeModalInnerBack) { closeModalBtn.addEventListener('click', closeModal); closeModalInnerBack.addEventListener('click', closeModal); } document.addEventListener('keydown', function (event) { if (event.code === 'Escape' && !modal.classList.contains('modal-restore-error--hidden')) { closeModal(); } }); } function modalReg() { // const openModalLink = document.querySelector(''); const closeModalBtn = document.querySelector('.js_modal_reg_close'); const closeModalInner = document.querySelector('.js_back_inner'); const modal = document.querySelector('.js_modal_reg'); const overlay = document.querySelector('.js_modal_reg_overlay'); const passwordField = document.querySelector('.js_reg_pass'); const showPasswordBtn = document.querySelector('.js_reg_show_pass'); const passwordFieldConfirm = document.querySelector('.js_pass_conf'); const showPasswordConfirmBtn = document.querySelector('.js_reg_show_pass_conf'); const openRestoreLink = document.querySelector('.js_restore_pass'); const openModal = function () { modal.classList.remove('modal-reg--hidden'); overlay.classList.remove('modal-reg-overlay--hidden'); // document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-reg--hidden'); overlay.classList.add('modal-reg-overlay--hidden'); // document.body.style.overflow = null; }; // if (openModalLink) { // openModalLink.addEventListener('click', openModal); // } if (closeModalBtn || closeModalInner) { closeModalBtn.addEventListener('click', closeModal); closeModalInner.addEventListener('click', closeModal); } if (openRestoreLink) { openRestoreLink.addEventListener('click', closeModal); } document.addEventListener('keydown', function (event) { if (event.code === 'Escape' && !modal.classList.contains('modal-reg--hidden')) { closeModal(); } }); if (showPasswordBtn) { showPasswordBtn.addEventListener('click', function () { if (passwordField.type === 'password') { passwordField.type = 'text'; } else { passwordField.type = 'password'; } }); } if (showPasswordConfirmBtn) { showPasswordConfirmBtn.addEventListener('click', function () { if (passwordFieldConfirm.type === 'password') { passwordFieldConfirm.type = 'text'; } else { passwordFieldConfirm.type = 'password'; } }); } } //Footer function footerSpoiler() { const spoilerButtons = document.querySelectorAll('.js_comp_btn'); let i; if (window.innerWidth < 481) { for (i = 0; i < spoilerButtons.length; i++) { spoilerButtons[i].addEventListener('click', function () { this.classList.toggle('footer-spoiler-button--active'); let panel = this.nextElementSibling; if (panel.style.maxHeight) { panel.style.maxHeight = null; } else { panel.style.maxHeight = panel.scrollHeight + 'px'; } }); } } else return; } //Главная страница function swiperMain() { var swiper = new Swiper('.mySwiper', { navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, allowSlidePrev: true, allowSlideNext: true, observer: true, observeParents: true, pagination: { el: '.swiper-pagination', paginationClickable: true, dynamicBullets: true, clickable: true, }, mousewheel: true, keyboard: true, }); // swiper.on('slideChange', function () { // if (swiper.activeIndex === 0) { // swiper.navigation.prevEl.classList.add('swiper-button-disabled'); // } else { // swiper.navigation.prevEl.classList.remove('swiper-button-disabled'); // } // if (swiper.isEnd) { // swiper.navigation.nextEl.classList.add('swiper-button-disabled'); // } else { // swiper.navigation.nextEl.classList.remove('swiper-button-disabled'); // } // }); } function swiperCatalog() { var swiper = new Swiper('.swiperCatalog', { pagination: { el: '.swiper-pagination', clickable: true, }, }); } function swiperMachines() { var swiper = new Swiper('.swiper-machine', { slidesPerView: 3, spaceBetween: 3, pagination: { el: '.swiper-pagination', clickable: true, }, allowTouchMove: false, }); } function swiperPartners() { var swiper = new Swiper('.swiper-partners', { slidesPerView: 3, spaceBetween: 30, navigation: { nextEl: '.swiper-button-next_partner', prevEl: '.swiper-button-prev_partner', }, }); } function catalogButtonsHandler() { const addToFavorite = document.querySelectorAll('.js_favorite'); const addToCompare = document.querySelectorAll('.js_compare'); addToFavorite.forEach((btn) => { btn.addEventListener('click', (e) => { e.preventDefault(); btn.classList.toggle('swiper-icons-right__favorite_active'); }); }); addToCompare.forEach((btn) => { btn.addEventListener('click', (e) => { e.preventDefault(); btn.classList.toggle('swiper-icons-right__compare_active'); }); }); } function catalogTabsHandler() { const tabs = document.querySelectorAll('.tab'); const tabsItems = document.querySelectorAll('.tabs__item'); tabs.forEach((tab) => { tab.addEventListener('click', function () { let currentBtn = tab; let tabId = currentBtn.getAttribute('data-tab'); let currentTab = document.querySelector(tabId); if (!currentBtn.classList.contains('active')) { tabs.forEach((tab) => { tab.classList.remove('active'); }); tabsItems.forEach((tab) => { tab.classList.remove('tabs__item-active'); }); currentBtn.classList.add('active'); currentTab.classList.add('tabs__item-active'); } }); }); } function cookiePopup() { const cookiePopup = document.querySelector('.js_cookie_popup'); const cookieButton = document.querySelector('.js_cookie_popup_btn'); let cookieName = 'cookie-vekprom=accepted'; if (cookiePopup) { if (document.cookie.includes(cookieName)) { return; } else { cookiePopup.style.display = 'block'; cookieButton.addEventListener('click', () => { document.cookie = 'cookie-vekprom=accepted; max-age=31536000; path=/'; cookiePopup.style.display = 'none'; }); } } } // страница Карточка товара function productPageSwiper() { var galleryTop = new Swiper('.gallery', { spaceBetween: 10, grabCursor: true, loop: true, loopedSlides: 4, keyboard: { enabled: true, onlyInViewport: false, }, }); /* thumbs */ var galleryThumbs = new Swiper('.gallery-thumbs', { spaceBetween: 10, centeredSlides: true, slidesPerView: 'auto', touchRatio: 0.4, slideToClickedSlide: true, keyboard: { enabled: true, onlyInViewport: false, }, }); /* set conteoller */ galleryTop.controller.control = galleryThumbs; galleryThumbs.controller.control = galleryTop; } function productTabs() { const tabs = document.querySelectorAll('.js-specification__tab'); const tabsItems = document.querySelectorAll('.specification__tabs-item'); tabs.forEach((tab) => { tab.addEventListener('click', function () { let currentBtn = tab; let tabId = currentBtn.getAttribute('data-tab'); let currentTab = document.querySelector(tabId); if (!currentBtn.classList.contains('active')) { tabs.forEach((tab) => { tab.classList.remove('active'); }); tabsItems.forEach((tab) => { tab.classList.remove('specification__tabs-item_active'); }); currentBtn.classList.add('active'); currentTab.classList.add('specification__tabs-item_active'); } }); }); } function telefonMask() { const phoneInputs = document.querySelectorAll('.js_input_phone'); phoneInputs.forEach((input) => { setPhoneMask(input); }); function setPhoneMask(phoneInput) { // маска для ввода номера телфона function setCursorPosition(pos, elem) { elem.focus(); if (elem.setSelectionRange) elem.setSelectionRange(pos, pos); else if (elem.createTextRange) { var range = elem.createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } } function mask(event) { var matrix = '+7 (___) ___ ____', i = 0, def = matrix.replace(/\D/g, ''), val = this.value.replace(/\D/g, ''); if (def.length >= val.length) val = def; this.value = matrix.replace(/./g, function (a) { return /[_\d]/.test(a) && i < val.length ? val.charAt(i++) : i >= val.length ? '' : a; }); if (event.type == 'blur') { if (this.value.length == 2) this.value = ''; } else setCursorPosition(this.value.length, this); } var numberPhone = phoneInput; if (numberPhone) { numberPhone.addEventListener('input', mask, false); numberPhone.addEventListener('focus', mask, false); numberPhone.addEventListener('blur', mask, false); } } } function offerSwiper() { var swiper = new Swiper('.swiper-catalog-item', { pagination: { el: '.swiper-pagination', clickable: true, }, }); } function swiperProjects() { var swiper = new Swiper('.swiper-projects', { slidesPerView: 3, spaceBetween: 30, navigation: { nextEl: '.swiper-button-next_projects', prevEl: '.swiper-button-prev_projects', }, }); } function swiperModels() { var swiper = new Swiper('.swiper-models', { slidesPerView: 3, spaceBetween: 20, navigation: { nextEl: '.swiper-button-next_models', prevEl: '.swiper-button-prev_models', }, scrollbar: { el: '.spec-scrollbar', hide: false, draggable: true, }, }); } function swiperViewed() { var swiper = new Swiper('.swiper-viewed', { slidesPerView: 4, spaceBetween: 20, navigation: { nextEl: '.swiper-button-next_viewed', prevEl: '.swiper-button-prev_viewed', }, }); } function swiperTab5() { var swiper = new Swiper('.swiper-tab-5', { slidesPerView: 1, navigation: { nextEl: '.swiper-button-next_tab-5', prevEl: '.swiper-button-prev_tab-5', }, }); } function swiperTab6() { var swiper = new Swiper('.swiper-tab-6', { slidesPerView: 1, navigation: { nextEl: '.swiper-button-next_tab-6', prevEl: '.swiper-button-prev_tab-6', }, }); } function swiperTab7() { var swiper = new Swiper('.swiper-tab-7', { slidesPerView: 4, navigation: { nextEl: '.swiper-button-next_tab-7', prevEl: '.swiper-button-prev_tab-7', }, }); } function addToCart() { const openModalLink = document.querySelector('.js_buy'); const closeModalBtn = document.querySelector('.js_modal_added_close'); const closeInModalBtn = document.querySelector('.js_modal_added_button'); const modal = document.querySelector('.js_modal_added'); const overlay = document.querySelector('.js-modal_added_overlay'); const openModal = function () { modal.classList.remove('modal-added--hidden'); overlay.classList.remove('modal-added-overlay--hidden'); // document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-added--hidden'); overlay.classList.add('modal-added-overlay--hidden'); // document.body.style.overflow = null; }; if (openModalLink) { openModalLink.addEventListener('click', openModal); } if (closeModalBtn || closeInModalBtn) { closeModalBtn.addEventListener('click', closeModal); closeInModalBtn.addEventListener('click', closeModal); } } function getConsult() { const openModalLink = document.querySelector('.js-cart__info-links-consult'); const closeModalBtn = document.querySelector('.js_modal_parts_close'); const modal = document.querySelector('.js_modal_consult'); const overlay = document.querySelector('.js_modal-parts--overlay'); const openModal = function () { modal.classList.remove('modal-parts__hidden'); overlay.classList.remove('modal-parts__overlay__hidden'); document.body.style.overflow = 'hidden'; }; const closeModal = function () { modal.classList.add('modal-parts__hidden'); overlay.classList.add('modal-parts__overlay__hidden'); document.body.style.overflow = null; }; if (openModalLink) { openModalLink.addEventListener('click', openModal); } if (closeModalBtn) { closeModalBtn.addEventListener('click', closeModal); } } // ymaps.ready(function initMap() { // let center = [55.60358306912159, 38.129899499999965]; // let secondPlaceMark = [55.607504069131686, 38.11306499999998]; // let map = new ymaps.Map('map', { // center: center, // zoom: 15, // }); // let placemark = new ymaps.Placemark( // center, // {}, // { // iconLayout: 'default#image', // iconImageHref: '../img/product/form/marker-big.svg', // iconImageSize: [52, 65], // iconImageOffset: [50, -10], // }, // ); // let placemarkTwo = new ymaps.Placemark( // secondPlaceMark, // {}, // { // iconLayout: 'default#image', // iconImageHref: '../img/product/form/marker-big.svg', // iconImageSize: [25, 32], // iconImageOffset: [45, 0], // }, // ); // map.controls.remove('geolocationControl'); // удаляем геолокацию // map.controls.remove('searchControl'); // удаляем поиск // map.controls.remove('trafficControl'); // удаляем контроль трафика // map.controls.remove('typeSelector'); // удаляем тип // map.controls.remove('fullscreenControl'); // удаляем кнопку перехода в полноэкранный режим // map.controls.remove('zoomControl'); // удаляем контрол зуммирования // map.controls.remove('rulerControl'); // удаляем контрол правил // map.behaviors.disable(['scrollZoom']); // отключаем скролл карты // map.geoObjects.add(placemark); // map.geoObjects.add(placemarkTwo); // }); // Карточка товара кратко (модальное окно) function modalProductTabs() { const tabs = document.querySelectorAll('.js-modal-spec__tab'); const tabsItems = document.querySelectorAll('.js-modal-spec__tabs-item'); tabs.forEach((tab) => { tab.addEventListener('click', function () { let currentBtn = tab; let tabId = currentBtn.getAttribute('data-tab'); let currentTab = document.querySelector(tabId); if (!currentBtn.classList.contains('active')) { tabs.forEach((tab) => { tab.classList.remove('active'); }); tabsItems.forEach((tab) => { tab.classList.remove('modal-spec__tabs-item_active'); }); currentBtn.classList.add('active'); currentTab.classList.add('modal-spec__tabs-item_active'); } }); }); } function modalViewed() { var swiper = new Swiper('.swiper-modal-viewed', { slidesPerView: 4, spaceBetween: 20, navigation: { nextEl: '.swiper-button-next_modal-viewed', prevEl: '.swiper-button-prev_modal-viewed', }, }); } // модальные окна // модальные окна - Заказать запчасти function orderParts() { const openModalLink = document.querySelector('.js-cart__info-links-parts'); const closeModalBtn = document.querySelector('.js-modal-parts__close'); const modal = document.querySelector('.js_modal-parts'); const overlay = document.querySelector('.js_modal-parts--overlay'); const openModalParts = function () { modal.classList.remove('modal-parts__hidden'); overlay.classList.remove('modal-parts__overlay__hidden'); document.body.style.overflow = 'hidden'; }; const closeModalParts = function () { modal.classList.add('modal-parts__hidden'); overlay.classList.add('modal-parts__overlay__hidden'); document.body.style.overflow = null; }; if (openModalLink) { openModalLink.addEventListener('click', openModalParts); } if (closeModalBtn) { closeModalBtn.addEventListener('click', closeModalParts); } } // модальное окно - Заказать консультацию // модальное окно - Товар добавлен в корзину function addedToCart() { var swiper = new Swiper('.swiper-modal-added', { slidesPerView: 3, spaceBetween: 20, navigation: { nextEl: '.modal-added-bottom__btn-next', prevEl: '.modal-added-bottom__btn-prev', }, scrollbar: { el: '.modal-added-scrollbar', hide: false, draggable: true, }, }); } function resultPagination() { // const pagination = document.querySelector('.result-pagination'); // const prevBtn = pagination.querySelector('.result-prev'); // const nextBtn = pagination.querySelector('.result-next'); // const pages = pagination.querySelectorAll('.result-content-page'); // const numPages = 24;xw // const numVisiblePages = 3; // let currentPage = 1; } // каталог function toggleList() { const acc = document.getElementsByClassName('js_catalog_accordion'); const titleTwo = document.querySelector('.js_cat_acc_two'); const titleThree = document.querySelector('.js_cat_acc_three'); const titleFive = document.querySelector('.js_cat_acc_five'); const titleSix = document.querySelector('.js_cat_acc_six'); const titleSeven = document.querySelector('.js_cat_acc_seven'); const titleEight = document.querySelector('.js_cat_acc_eight'); let i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener('click', function () { this.classList.toggle('catalog-accordion--active'); let panel = this.nextElementSibling; if (panel.style.maxHeight) { panel.style.maxHeight = null; } else { panel.style.maxHeight = panel.scrollHeight + 'px'; } }); } if (titleTwo) { titleTwo.addEventListener('click', function () { titleTwo.classList.toggle('cat-acc-two--active'); }); } if (titleThree) { titleThree.addEventListener('click', function () { titleThree.classList.toggle('cat-acc-three--active'); }); } if (titleFive) { titleFive.addEventListener('click', function () { titleFive.classList.toggle('cat-acc-five--active'); }); } if (titleSix) { titleSix.addEventListener('click', function () { titleSix.classList.toggle('cat-acc-six--active'); }); } if (titleSeven) { titleSeven.addEventListener('click', function () { titleSeven.classList.toggle('cat-acc-seven--active'); }); } if (titleEight) { titleEight.addEventListener('click', function () { titleEight.classList.toggle('cat-acc-eight--active'); }); } } function toogleSorting() { const sortingItems = document.querySelectorAll('.js_result_sorting_item'); sortingItems.forEach((item) => { item.addEventListener('click', () => { if (!item.classList.contains('result-sorting__item--active')) { sortingItems.forEach((item) => { item.classList.remove('result-sorting__item--active'); }); item.classList.add('result-sorting__item--active'); } }); }); } function swiperArticles() { var swiper = new Swiper('.swiper-catalog-articles', { slidesPerView: 4, spaceBetween: 20, navigation: { nextEl: '.swiper-button-next__catalog-articles', prevEl: '.swiper-button-prev__catalog-articles', }, }); } function swiperReviews() { var swiper = new Swiper('.swiper-catalog-reviews', { slidesPerView: 3, spaceBetween: 20, navigation: { nextEl: '.swiper-button-next__catalog-reviews', prevEl: '.swiper-button-prev__catalog-reviews', }, }); } // о компании function swiperHistory() { var swiper = new Swiper('.swiper-about-history', { direction: 'vertical', slidesPerView: 1, loopFillGroupWithBlank: true, centeredSlides: true, spaceBetween: 40, navigation: { nextEl: '.swiper-button-next__about-history', prevEl: '.swiper-button-prev__about-history', }, }); }