console.log("test");
$(document).ready(function () {
$("#toc_container").clone().appendTo(".toc_aside");
$(function () {
let header_fix = $(".main-header");
let hederHeight = header_fix.height(); // вычисляем высоту шапки
$(window).scroll(function () {
if ($(this).scrollTop() > 1) {
header_fix.addClass("header_fixed");
$("body").css({
paddingTop: hederHeight + "px", // делаем отступ у body, равный высоте шапки
});
} else {
header_fix.removeClass("header_fixed");
$("body").css({
paddingTop: 0, // удаляю отступ у body, равный высоте шапки
});
}
});
});
var wrap = $(".toc_aside_wrapp");
var sidebar = $(".toc_aside_fixed");
if (wrap.length) {
$(window).scroll(function () {
var sdb = $(document).scrollTop();
var sdb1 = wrap.offset().top;
var sdb2 = sdb1 + wrap.outerHeight() - $(window).height();
if (sdb > sdb1) {
sidebar.css("position", "fixed");
} else {
sidebar.css("position", "absolute");
}
if (sdb > sdb2) {
sidebar.css("top", sdb2 - sdb);
} else {
sidebar.css("top", 140);
}
});
}
var sections = $(".single-article__content h2 span"),
nav = $("#toc-widget-2"),
nav_height = nav.outerHeight();
$(window).on("scroll", function () {
var cur_pos = $(this).scrollTop();
sections.each(function () {
var top = $(this).offset().top - nav_height + 80,
bottom = top + $(this).outerHeight();
if (cur_pos >= top && cur_pos <= bottom) {
nav.find("a").removeClass("active");
sections.removeClass("active");
$(this).addClass("active");
nav.find('a[href="#' + $(this).attr("id") + '"]').addClass("active");
}
});
});
nav.find("a").on("click", function () {
var $el = $(this),
id = $el.attr("href");
$("html, body").animate(
{
scrollTop: $(id).offset().top - nav_height + 100,
},
500,
);
return false;
});
("use strict");
$("img.lazy").Lazy();
$.event.special.touchstart = {
setup: function (_, ns, handle) {
this.addEventListener("touchstart", handle, {
passive: !ns.includes("noPreventDefault"),
});
},
};
$.event.special.touchmove = {
setup: function (_, ns, handle) {
this.addEventListener("touchmove", handle, {
passive: !ns.includes("noPreventDefault"),
});
},
};
$.event.special.wheel = {
setup: function (_, ns, handle) {
this.addEventListener("wheel", handle, { passive: true });
},
};
$.event.special.mousewheel = {
setup: function (_, ns, handle) {
this.addEventListener("mousewheel", handle, { passive: true });
},
};
// Поддержка показа svg иконок для старых браузеров
svg4everybody();
// Открыть/Закрыть окно поиска в десктопной версии
(function () {
$(".main-header__search-btn").click(function () {
$(".main-search").addClass("main-search--active");
});
$(document).click(function (e) {
let container = $(".main-header__search");
if (container.has(e.target).length === 0) {
$(".main-search").removeClass("main-search--active");
}
});
})();
$(".is-search-icon").click(function () {
$("#is-search-form").slideToggle();
});
$(".search-icon-close").click(function () {
$("#is-search-form").slideToggle();
});
//$('.promo.promo--inner').after($('.breadcrumbs_new_wrapp'));
//Слайдеры
//=============================================================================
$("#slider-clients__items").owlCarousel({
loop: true,
margin: 40,
nav: true,
responsive: {
0: {
items: 2,
},
600: {
items: 3,
},
1000: {
items: 8,
},
},
});
$(".promo__slider.owl-carousel").owlCarousel({
smartSpeed: 400,
items: 1,
dots: true,
nav: true,
dotsContainer: ".promo__dots",
responsive: {
0: {},
991.9: {},
},
});
//review slider
let reviewItems = 3;
let reviewItemsTablet = 2;
if ($(".review__list").hasClass("review__list--col-2")) {
reviewItems = 2;
reviewItemsTablet = 1;
}
$(".review__list.owl-carousel").owlCarousel({
smartSpeed: 250,
nav: true,
dots: true,
responsive: {
0: {
items: 1,
margin: 0,
},
719.9: {
items: 2,
margin: 20,
},
768: {
items: reviewItemsTablet,
margin: reviewItemsTablet === 1 ? 0 : 20,
},
973.9: {
items: reviewItems,
margin: 24,
},
},
});
$(".news-slider").owlCarousel({
smartSpeed: 400,
items: 1,
nav: true,
dots: true,
});
$(".see-also__list.owl-carousel").owlCarousel({
smartSpeed: 250,
items: 1,
nav: false,
dots: true,
responsive: {
0: {
items: 1,
},
720: {
items: 3,
margin: 20,
},
974: {
items: 6,
margin: 24,
},
},
});
$(".solutions__list.owl-carousel").owlCarousel({
smartSpeed: 250,
items: 4,
nav: true,
dots: true,
responsive: {
0: {
items: 2,
},
420: {
items: 2,
},
720: {
items: 3,
},
974: {
items: 4,
},
},
});
$(".related-services__list.owl-carousel").owlCarousel({
smartSpeed: 250,
items: 4,
nav: true,
dots: true,
responsive: {
0: {
items: 1,
},
420: {
items: 1,
},
720: {
items: 2,
},
974: {
items: 4,
},
},
});
//=============================================================================
$("body").on("click", ".upper-btn", {}, function () {
$("html, body").animate({ scrollTop: 0 }, 600);
});
$(window).scroll(function () {
if ($(window).scrollTop() < 300) {
$(".upper-btn").removeClass("active");
} else $(".upper-btn").addClass("active");
});
//Плавная прокрутка до якоря
$("body").on("click", '[href*="#"]', function (e) {
$("html,body")
.stop()
.animate({ scrollTop: $(this.hash).offset().top }, 600);
e.preventDefault();
});
//Переключение гамбургер меню
$(".hamburger-btn").click(function () {
$(this).toggleClass("hamburger-btn--active");
$(".mobile-nav").toggleClass("mobile-nav--open");
$("body").toggleClass("lock");
});
//Открытие подменю в мобильной версии
//=============================================================================
$(".mobile-nav__link").click(function () {
$(this).parents(".mobile-nav__item").toggleClass("active");
});
$(".mobile-nav__submenu-btn").click(function () {
$(this).parents(".mobile-nav__submenu-item").toggleClass("active");
});
//=============================================================================
//Открытие меню по клику
$(".main-nav__item > .main-nav__link").click(function (e) {
e.stopPropagation();
let $parentItem = $(this).closest(".main-nav__item");
let parentDropdown = $parentItem.closest(".dropdown-menu");
let childDropdown = $parentItem.children(".dropdown-menu");
$(".dropdown-menu").not(parentDropdown).not(childDropdown).slideUp(250);
$(".main-nav__item").not($parentItem).removeClass("active");
$parentItem
.toggleClass("active")
.children(".dropdown-menu")
.eq(0)
.slideToggle(250);
});
$(".main-nav__item.is__parent").hover(
function () {
clearTimeout($(this).data("closeTimer"));
if (!$(this).hasClass("active")) {
$(this)
.addClass("active")
.children(".dropdown-menu")
.first()
.stop(true, true)
.slideDown(250);
}
},
function () {
let $this = $(this);
$this.data(
"closeTimer",
setTimeout(function () {
if (!$this.is(":hover")) {
$this
.removeClass("active")
.children(".dropdown-menu")
.first()
.stop(true, true)
.slideUp(250);
}
}, 200),
);
},
);
//Закрытие меню по клику в не области меню
$(document).on("click", function (e) {
if (!$(e.target).closest(".main-nav").length) {
$(".dropdown-menu").slideUp(250);
$(".main-nav__item").removeClass("active");
}
e.stopPropagation();
});
if ($(document).width() < 578) {
$(document).on("click", function (e) {
if ($(".mobile-nav").hasClass("mobile-nav--open")) {
if (!$(e.target).closest(".main-header").length) {
$(".hamburger-btn").toggleClass("hamburger-btn--active");
$(".mobile-nav").toggleClass("mobile-nav--open");
$("body").toggleClass("lock");
} else {
}
e.stopPropagation();
}
});
}
//fancybox для картинок
$('[data-fancybox="gallery"]').fancybox({
buttons: ["close", "zoom"],
});
//fancybox для модальных окон
$('[data-fancy="modal"]').fancybox({
closeExisting: false,
arrows: false,
infobar: false,
hash: false,
btnTpl: {
close:
'',
smallBtn:
'',
},
touch: false,
beforeShow: function () {
$("html").css({ "overflow-y": "hidden" });
},
afterClose: function () {
$("html").removeAttr("style");
},
});
//Показать/скрыть текст в отзывах
$(".review__more").click(function () {
$(this)
.toggleClass("active")
.siblings(".review__text")
.toggleClass("active");
});
//FAQ
$(".faq__quest").click(function () {
$(this).parent().toggleClass("active");
$(this).siblings(".faq__answer").slideToggle();
});
//Tabs
$(".js-tab-trigger").click(function () {
var id = $(this).attr("data-tab"),
content = $('.js-tab-content[data-tab="' + id + '"]');
$(".js-tab-trigger.active").removeClass("active");
$(this).addClass("active");
$(".js-tab-content.active").removeClass("active");
content.addClass("active");
});
$('[data-src="#modal-supports"]').click(function () {
var modalTitle = $("#modal-supports").find(".modal__title");
if ($(this).hasClass("main-header__connect-btn")) {
// modalTitle.text('Connect a new service');
modalTitle.text("Закажите бесплатный звонок");
return;
}
//modalTitle.text('New support ticket');
modalTitle.text("Новое обращение в службу поддержки");
});
//Маска для телефона
$('input[type="tel"]').mask("+9 (999) 999-99-99", { autoclear: false });
//Правила и медоты валидации форм
$("form").each(function (i, el) {
$(".form__errors").hide();
var validator = $(this).validate({
errorElement: "span",
errorPlacement: function (e, t) {
$(t).siblings(".form__label").addClass("error");
},
ignore: ":hidden",
rules: {
name: { required: true, minlength: 2, maxlength: 30 },
organization: { required: true, minlength: 2, maxlength: 100 },
email: { required: true, email: true },
phone: { minlength: 18, maxlength: 22, required: true },
policy: { required: true },
policy1: { required: true },
policy2: { required: true },
},
highlight: function (element, errorClass, validClass) {
$(element).removeClass(validClass);
$(element)
.addClass(errorClass)
.siblings(".form__label")
.addClass("error");
},
unhighlight: function (element, errorClass, validClass) {
$(element).removeClass(errorClass);
$(element)
.addClass(validClass)
.siblings(".form__label")
.removeClass("error");
},
success: function () {
var thisFormCheck = $(el).validate().checkForm();
if (thisFormCheck === true) {
$(".form__btn").removeAttr("disabled");
$(".form__errors").hide();
}
},
invalidHandler: function (event, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
$(".form__errors").show();
$(".form__btn").attr("disabled", true);
} else {
$(".form__errors").hide();
$(".form__btn").removeAttr("disabled");
}
},
submitHandler: function (e) {
if ($(el).validate().checkForm()) {
el.page.value = window.location;
$.fancybox.close({
src: "#modal-message",
});
$.fancybox.open({
src: "#modal-success",
});
//ROISTAT BEGIN
var form = $(el),
fields = form.find(
'input[type="text"],input[type="email"],input[type="tel"],input[type="hidden"], input[type="radio"]:checked, select, textarea',
),
leadName = "Новый лид",
formName = form.find('input[name="form_name"]').length
? form.find('input[name="form_name"]').val()
: "",
name = "",
phone = "",
email = "",
comment = "",
org = "";
fields.each(function () {
var title = $(this).closest(".form__item").find("label").length
? $(this)
.closest(".form__item")
.find("label")
.eq(0)
.text()
.replace(/\*/g, "")
.trim()
: "";
switch (title) {
case "Имя":
name = $(this).val();
break;
case "E-mail":
email = $(this).val();
break;
case "Телефон":
phone = $(this).val().replace(/\D/g, "");
break;
case "Организация":
org = $(this).val();
break;
default:
if (title && $(this).val().trim().length)
comment += title + ": " + $(this).val() + "\n";
if (
!title &&
$(this).prop("nodeName").toLowerCase() == "textarea"
)
comment += $(this).val() + "\n";
break;
}
});
if (formName) {
leadName = formName;
comment += "Форма : " + leadName + "\n";
}
var roistatExtraFields = {};
var policy1Input = form.find('input[name="policy1"]');
var policy2Input = form.find('input[name="policy2"]');
if (policy1Input.length || policy2Input.length) {
var policy1Checked = policy1Input.is(":checked");
var policy2Checked = policy2Input.is(":checked");
comment +=
"Согласие обработки ПД (policy1): " +
(policy1Checked ? "да" : "нет") +
"\n";
comment +=
"Согласие политики конфиденциальности (policy2): " +
(policy2Checked ? "да" : "нет") +
"\n";
roistatExtraFields.policy1_consent = policy1Checked ? "да" : "нет";
roistatExtraFields.policy2_consent = policy2Checked ? "да" : "нет";
}
leadName = org ? org : leadName;
if (phone.length || email.length) {
roistatGoal.reach({
leadName: leadName,
name: name,
phone: phone,
email: email,
text: comment,
fields: Object.assign({
701349: "{landingPage}",
701351: "{source}",
701353: "{city}",
701355: "{utmSource}",
701357: "{utmMedium}",
701359: "{utmCampaign}",
701337: "{utmTerm}",
701361: "{utmContent}",
667693: "Входящий запрос с сайта/Incoming website lead",
}, roistatExtraFields),
});
}
//ROISTAT END
}
},
});
// Добавляем обработчик для чекбоксов policy1 и policy2
$(el).on("input change", ":input", function () {
validator.form();
checkFormValidity(el);
});
});
setTimeout(function () {
$.post("/get_head", {}, function (html) {
$("head").append(html);
});
}, 4000);
});
function checkFormValidity(el) {
var thisFormCheck = $(el).validate().checkForm();
if (thisFormCheck === true) {
$(".form__btn").removeAttr("disabled");
$(".form__errors").hide();
} else {
$(".form__btn").attr("disabled", true);
$(".form__errors").show();
}
}
$(document).ready(function () {
$(".slider_el").slick({
arrows: true,
infinite: false,
slidesToShow: 4,
adaptiveHeight: true,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
},
},
{
breakpoint: 725,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
if ($(document).width() > 768) {
let maxBlock = 0;
$(".articles__title, .keysy__title").each(function () {
if ($(this).height() > maxBlock) maxBlock = $(this).height();
});
$(".articles__title, .keysy__title").css({
height: maxBlock,
"padding-bottom": 25,
});
let maxHeightServiceTitle = 0;
$(".same-height .relink-error__title").each(function () {
if ($(this).height() > maxHeightServiceTitle)
maxHeightServiceTitle = $(this).height();
});
$(".same-height .relink-error__title").css({
height: maxHeightServiceTitle,
});
let maxHeightServiceItem = 0;
$(".same-height .relink-error__item").each(function () {
if ($(this).height() > maxHeightServiceItem)
maxHeightServiceItem = $(this).height();
});
$(".same-height .relink-error__item").css({ height: maxHeightServiceItem });
let maxSliderItem = 0;
$(".container_slider_el .slide_item").each(function () {
if ($(this).height() > maxSliderItem) maxSliderItem = $(this).height();
});
$(".container_slider_el .slide_item").css({ height: maxSliderItem });
}
let maxBlockFunc = 0;
$(".functionality__item").each(function () {
if ($(this).height() > maxBlockFunc) maxBlockFunc = $(this).height();
});
$(".functionality__item").css({ height: maxBlockFunc });
const modalIn = document.getElementById("modal-in");
const modalImgIn = document.querySelector("#modal-content-in");
const closeButtonIn = document.getElementById("close-in");
closeButtonIn.addEventListener("click", () => {
modalIn.style.display = "none";
document.body.classList.remove("modal-fix");
});
const imagesIn = document.querySelectorAll(
".single-article__content .keysy__img",
);
imagesIn.forEach((image) => {
image.classList.add("img-hover");
image.addEventListener("click", () => {
modalIn.style.display = "flex";
modalImgIn.src = image.src;
document.body.classList.add("modal-fix");
});
});
});
document.addEventListener("DOMContentLoaded", function () {
var lazyBackgrounds = [].slice.call(
document.querySelectorAll(".lazy-background"),
);
if ("IntersectionObserver" in window) {
let lazyBackgroundObserver = new IntersectionObserver(function (
entries,
observer,
) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
entry.target.classList.add("visible");
lazyBackgroundObserver.unobserve(entry.target);
}
});
});
lazyBackgrounds.forEach(function (lazyBackground) {
lazyBackgroundObserver.observe(lazyBackground);
});
}
});
document.addEventListener("DOMContentLoaded", () => {
const tabsList = document.querySelector(".interactable-tabs .tabs-list");
if (!tabsList) return;
const tabButtons = tabsList.querySelectorAll("button");
const tabContents = Array.from(
document.querySelectorAll('.interactable-tabs [id^="tab"]'),
).filter((el) => !el.matches("button, .tabs-list"));
tabsList.style.display = "flex";
tabContents.forEach((el) => (el.style.display = "none"));
if (tabButtons.length) {
const firstTabId = tabButtons[0].id;
const firstContent = tabContents.find((el) => el.id === firstTabId);
if (firstContent) firstContent.style.display = "block";
tabButtons[0].classList.add("active");
}
tabButtons.forEach((btn) => {
btn.addEventListener("click", () => {
tabButtons.forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
tabContents.forEach(
(el) => (el.style.display = el.id === btn.id ? "block" : "none"),
);
});
});
});