Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/local/templates/catalogs/js/ |
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/local/templates/catalogs/js/main.js |
window.addEventListener('DOMContentLoaded', function () { [...document.querySelectorAll('img[data-src]')].forEach(img => { if (img.dataset.src) { img.src = img.dataset.src; } }) }) document.addEventListener('DOMContentLoaded', () => { const body = document.querySelector('body') const toTopBtn = document.querySelector('.btn_to_top'); // let bntQuiz = document.querySelector('.quiz_btn') //let quiz = document.querySelector('.s_quiz') let maskPhone = document.querySelectorAll('._mask_phone') const swiperAbout = new Swiper('.swiper-about', { navigation: { nextEl: '.about-btn-next', prevEl: '.about-btn-prev' }, breakpoints: { 320: { direction: "horizontal", slidesPerView: 'auto', spaceBetween: 6, }, 961: { direction: "vertical", slidesPerView: 'auto', }, } }); const swiperDocuments = new Swiper('.swiper-documents', { slidesPerView: 'auto', navigation: { nextEl: '.documents-btn-next', prevEl: '.documents-btn-prev' }, }); const swiperTeam = new Swiper('.swiper-team', { slidesPerView: 'auto', navigation: { nextEl: '.team-btn-next', prevEl: '.team-btn-prev' }, }); Fancybox.bind("[data-fancybox]", { autoFocus: false }); // DETAIL const swiperDetailMain = new Swiper('.swiper_detail_main', { loop: true, grabCursor: true, navigation: { prevEl: '.swiper_detail_main_prev', nextEl: '.swiper_detail_main_next', }, }); const swiperDetailInterior = new Swiper('.swiper_detail_interiors', { loop: true, grabCursor: true, navigation: { prevEl: '.swiper_detail_interior_prev', nextEl: '.swiper_detail_interior_next', }, }); const swiperDetailTriggers = new Swiper('.swiper_detail_triggers', { loop: true, grabCursor: true, navigation: { prevEl: '.swiper_detail_triggers_prev', nextEl: '.swiper_detail_triggers_next', }, }); if (maskPhone) { maskPhone.forEach(e => IMask(e, {mask: '+{7} (000) 000-00-00'})); } window.onscroll = () => { if(window.scrollY > 1000) { toTopBtn.classList.add('_active') } else { toTopBtn.classList.remove('_active') } }; toTopBtn.onclick = () => { window.scrollTo({ top: 0, behavior: 'smooth' }) } });