$(document).ready(function () { /* ----------------- animation form ----------------- */ function goToTab(el) { let id = el.attr('data-tab'); el.closest('form>div').hide(); $(id).fadeIn(); } $(".gototab").on("click", function (event) { event.preventDefault(); goToTab($(this)); return false; }); $(".gototab-2").on("click", function (event) { event.preventDefault(); goToTab($(this)); return false; }); /* ----------------- accordeon ----------------- */ $('.ac-head').click(function () { $(this).toggleClass('in').next().slideToggle(); }); /* ----------------- mobile menu ----------------- */ let hum = $('.hum-menu'), menu = $('.mobile-menu'), overflow = $('.overflow'); hum.on('click', function () { if (overflow.css('display') == 'none') { openMenu(); } else { closeMenu(); } }); overflow.on('click', function () { closeMenu(); }); function openMenu() { menu.slideDown(); overflow.fadeIn(); $("body").css("overflow", "hidden"); } function closeMenu() { menu.slideUp(); overflow.fadeOut(); $("body").css("overflow", "auto"); } /* ----------------- circle anim ----------------- */ $(window).on('load resize', function () { if ($(window).width() <= '781') { $('.box-step').on('click', function () { $(this).toggleClass('show-box'); }); } }); // якорь $('a[href^="#"]').click(function () { var el = $(this).attr('href'); $('body').animate({ scrollTop: $(el).offset().top }, 2000); return false; }); /* ----------------- scroll ----------------- */ $(".arrow-down").on('click', getArrow); $(".arrow-top").on('click', getArrow); function getArrow() { var elementClick = $(this).attr("href") var destination = $(elementClick).offset().top; jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 1000); return false; } }); // get faq const slide = $('.box-slide'), faqBlock = $('.ac-head'); $.each(slide, function (index) { $(this).children('.bnt_read').on('click', function () { sessionStorage.setItem('GetBtnFaq', index + 1); }); }); if (sessionStorage.getItem('GetBtnFaq')) { $.each(faqBlock, function (index) { const getCord = sessionStorage.getItem('GetBtnFaq'); if (getCord == index + 1) { const destination = $(this).offset().top - 90; $('html').animate({ scrollTop: destination }, 800); $('body').animate({ scrollTop: destination }, 800); $(this).toggleClass('in').next().delay(800).slideDown(); } }); } else { console.log('not found session'); } $('.clear-sess').on('click', function () { sessionStorage.removeItem('GetBtnFaq'); }); /* ----------------- fixed header skroll ----------------- */ function resizeMenu(h_hght) { $(window).scroll(function () { let elem = $('.top_nav'), top = $(this).scrollTop(); if (top < h_hght) { elem.css({ 'background': 'transparent', 'padding': '25px 0' }); } else { elem.css({ 'background': 'linear-gradient(to right, #49a09d 0%, #5f2c82 100%)', 'padding': '20px 0' }); } }); }; resizeMenu(50); // align center select $('.focus-select').change(function () { $(this).closest('.form-group').find('.selected-inf').html(($(this).val() != 0) ? $(this).val() : ''); });