function initFixBlock() {
var windowHeight = $(window).height();
var documentHeight = $(document).height();
if (documentHeight - windowHeight < 100) {
$('.bottom-line').hide();
}
}
$(document).ready(function () {
initFixBlock();
$('.anchor-link').on('click', function (e) {
var anchor = $(e.currentTarget);
var headerHeight = $('.header').outerHeight();
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top - headerHeight
}, 777);
e.preventDefault();
return false;
});
$('.mobile-menu__link').on('click', function (e) {
var anchor = $(e.currentTarget);
var headerHeight = $('.header').outerHeight();
$('.mobile-menu').hide();
$('.burger').removeClass('open');
$('html, body').stop().animate({
scrollTop: $(anchor.attr('href')).offset().top - headerHeight
}, 777);
e.preventDefault();
});
$('.burger').on('click', function (e) {
var $menu = $('.mobile-menu');
if ($menu.is(':hidden')) {
$(e.currentTarget).addClass('open');
$menu.show();
} else {
$(e.currentTarget).removeClass('open');
$menu.hide();
}
});
$(window).on('scroll', function () {
var windowPos = $(window).scrollTop();
var windowHeight = $(window).height();
var documentHeight = $(document).height();
var bottomHeight = $('.block-bottom').outerHeight();
var result = documentHeight - (windowPos + windowHeight);
if (result < bottomHeight) {
$('.bottom-line').hide();
} else {
$('.bottom-line').show();
}
});
AOS.init({
disable: 'mobile',
offset: 200,
duration: 800
});
$('.btn-popup').on('click', function (e) {
var popup = $(e.currentTarget).attr('data-modal');
$("".concat(popup)).addClass('is-open');
return false;
});
$('.popup__close').on('click', function () {
$('.popup').removeClass('is-open');
var reSrc = $('#video').attr('src');
$('#video').attr('src', reSrc);
return false;
});
});
$(window).on('load', function () {
if (innerWidth > 1199) {
$('.stretch').each(function (index, item) {
var elmt = $(item);
var contWidth = elmt.width();
var txt = elmt.html();
var oneLine = $("".concat(txt, ""));
var nbChar = elmt.text().length;
var spacing = contWidth / nbChar;
var txtWidth;
elmt.html(oneLine);
txtWidth = oneLine.width();
if (txtWidth < contWidth) {
var charWidth = txtWidth / nbChar;
var ltrSpacing = spacing - charWidth + (spacing - charWidth) / nbChar;
oneLine.css({
'letter-spacing': ltrSpacing
});
} else {
oneLine.contents().unwrap();
elmt.html($("".concat(txt, "")));
elmt.addClass('justify');
}
var bottomFooterH = $('.bottom-line').height();
var fS = parseInt($('.bottom-line').find('span').css('font-size'), 10);
var k = 64;
if (fS < 48) {
k = 40;
}
var tR = bottomFooterH / k;
$('.bottom-line').find('span').css('transform', "scaleY(".concat(tR, ")"));
});
}
});