$(document).ready(function (){ // // Срабатывание цели (ЯндексМетрика, GoogleAnalytics) // window.goal = function (event) { if (event) { console.log('Сработала цель: ', event); if (typeof yaCounter !== 'undefined') yaCounter.reachGoal(event); if (typeof ym !== 'undefined' && window.theme.metrika) ym(window.theme.metrika, 'reachGoal', event); if (typeof gtag !== 'undefined') gtag('event', 'send', { 'event_category': 'forms', 'event_label': event }); } } // // Срабатывание цели при отправке форм // $('form').on('ajaxSuccess', function (event, context, data, jqXHR) { $("#spasibo").show(); }); // // Адрес страницы в формах // $('input[type=hidden][name=href]').val(window.location.href); // // Alert из Backcall формы // $(document).bind('ajaxAlways', function(event, two, partials) { var partial = partials['responseJSON'] ? partials.responseJSON['#BackcallForm_forms_flash'] : partials['#BackcallForm_forms_flash'] if(partial) { $('.BackcallForm_forms_flash').empty(); $(partial).appendTo($('.BackcallForm_forms_flash')); event.target.reset(); } }); // // Закрытие BackcallForm alert // $(document).on('click', '.BackcallForm_forms_flash .uk-alert-close', function (){ $('.BackcallForm_forms_flash').empty(); }); // // Чекнуть галочку лицензии // $(document).on('click', '#modal-agreement .uk-button-primary', function (){ $('.snippet-agreement input').prop('checked', true); }); $(document).on('click', '#modal-agreement .uk-button-default', function (){ $('.snippet-agreement input').prop('checked', false); }); }); window.backcall = function (options) { var $modal = $('#modal-backcall'), $message = $('.__message', $modal); // значения по умолчанию var data = Object.assign({ title: 'Заказать звонок', description: '', goal: 'backcall', href: window.location.href, button: 'Отправить', message: null, email: false, preform: null, postform: null, contact: 'phone', username: 'name', }, options); if(options.message === true) data.message = 'Сообщение:'; data.contact = _.get({ phone: 'Ваш телефон:', email: 'Ваш email:', both:'Ваш телефон или E-mail:' }, data.contact, data.contact); data.username = _.get({ name: 'Имя:', fullname: 'ФИО:', }, data.username, data.username); // заполняем модал $('.__title', $modal).text(data.title); $('.__button', $modal).text(data.button); $('.__contact label', $modal).text(data.contact); $('.__username label', $modal).text(data.username); $('input[name=href]', $modal).val(data.href); $('input[name=goal]', $modal).val(data.goal); $('input[name=title]', $modal).val(data.title); $('input[name=description]', $modal).val(data.description); // Сообщение нужно или нет и его лейбл $('textarea', $message).val(''); $('label', $message).text(data.message); if(data.message) $message.show(); else $message.hide(); // чистим прошлый alert $('#BackcallForm_forms_flash', $modal).html(''); // Вставляем дополнительные части формы $('.__preform', $modal).html($(data.preform).html() || ''); $('.__postform', $modal).html($(data.postform).html() || ''); // показываем модал UIkit.modal($modal).show(); } var Backcall = { args: 'title', props: { title: String, description: String, goal: String, contact: String, username: String, message: Boolean, button: String, preform: String, postform: String, }, data: { title: null, description: null, goal: null, contact: null, username: null, message: false, button: null, preform: null, postform: null, }, events: [ { name: 'click', handler: function(e) { this.toggle(); } } ], methods: { toggle: function(type) { var options = _.pick(this, _.keys(Backcall.data)); window.backcall(_.pickBy(options)); } } }; UIkit.component('backcall', Backcall); $(document).ready(function () { // делай что хочешь, полная свобода // toTop button>>> var toTop = $('.zone-header .toTop'); $(window).scroll(function () { if ($(window).scrollTop() > 300) { toTop.addClass('show'); } else { toTop.removeClass('show'); } }); toTop.on('click', function () { $('html, body').animate({ scrollTop: 0 }); }); //<<= 160 && !scrolled) { // scrolled = true; // $("header").addClass("scrolled") // } else if (scroll < 160) { // scrolled = false; // $("header").removeClass("scrolled") // } // } // $(window).scroll(updateScroll); // updateScroll(); // // Leaflet карта >>> // var map = L.map('map').setView([59.841055, 30.297891], 13); // L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { // maxZoom: 18, // attribution: 'Map data © OpenStreetMap contributors, ' + // 'CC-BY-SA, ' + // 'Imagery © Mapbox', // id: 'mapbox.streets' // }).addTo(map); // //<<< Leaflet карта var partnersSwiper = new Swiper('.snippet-infoblock .swiper-container', { loop: false, slidesPerView: 1, touchRatio: 0, // autoplay: { // delay: 7000, // }, effect: 'fade', pagination: { el: '.swiper-pagination', type: 'bullets', clickable: true, } }) var testimonialsSwiper = new Swiper('.snippet-testimonials .swiper-container', { loop: true, slidesPerView: 3, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, spaceBetween: 30, breakpoints: { 960: { slidesPerView: 2, }, 640: { slidesPerView: 1, } } }) var banksSwiper = new Swiper('.snippet-banks .swiper-container', { loop: true, slidesPerView: 5, spaceBetween: 30, autoplay: { delay: 7000, }, breakpoints: { 1200: { slidesPerView: 4, }, 960: { slidesPerView: 3, }, 640: { slidesPerView: 2, } } }) });