$(document).ready(function(){ $('.mobile-menu__link:not(.mobile-menu__link_hassub), .mobile-menu__level .anchor-scroll').on('click', () => { $('.mobile-menu').removeClass('active'); }); /* rejoin_path = "/nous-rejoindre/"; if (window.location.href.indexOf(rejoin_path) == -1) { $.ajax({ type: "POST", url: rejoin_path, cache: true, dataType: 'html', success: function(data){ $(data).find('[data-anchor]').each(function(i){ var anchor_id = 'rejoin_'+i; var anchor_text = $(this).attr('data-anchor'); $(this).attr('id', anchor_id); link = ''+anchor_text+''; $(document).find('.offer-anchors').append(link); }); }, error: function(jqXHR, textStatus, errorThrown) { console.log(textStatus, errorThrown); }, complete: function(){ } }); }*/ $(document).find('input').attr('autocomplete','new-password'); $(window).scroll(function() { if ($(this).scrollTop() > 0) { $('.header').addClass('fixed'); $('.header__mobile-nav').addClass('fixed'); $('.apply-btn').removeClass('active'); } else { $('.header').removeClass('fixed'); $('.header__mobile-nav').removeClass('fixed'); $('.apply-btn').addClass('active'); } }); //$(document).on("click", ".anchor-scroll", function(){ $(document).on("click", '.anchor-scroll', function(){ var _offset; var _anchor = $(this).attr("href"); _anchor === "#" ? _offset = 0 : _offset = $(_anchor).offset().top; $("html, body").animate({ scrollTop: _offset }, 1000); return false; }); $(document).on("click", ".scroll-down__btn", function(){ var _anchor = $(this).parent().next(); var _offset = $(_anchor).offset().top; $("html, body").animate({ scrollTop: _offset }, 1000); return false; }); $(".modal-popup__close, .modal-popup__overlay").click(function (){ $(".modal-popup").removeClass("active"); }); $(document).on("click", ".product-btns__block_order", function(){ var _name = $(this).attr("data-name"); $(document).find(".popup-form__name").html(_name); $(".popup-form").addClass("active"); }); $(document).on("click", ".policy-btn", function(){ $(".policy").addClass("active"); }); $(document).on("click", ".nav-menu__close, .nav-menu__overlay, .header__menu-trigger", function(){ $(".nav-menu").toggleClass("active"); }); $(window).resize(function(){ $(".nav-menu").removeClass("active"); }); $('.header__mobile-nav-menu-wrapper').on("click", ".menu-item-has-children .sub-menu a", function(){ $('.header__mobile-nav-button').trigger('click'); }); $('.header__search-btn').click(function(){ $(this).toggleClass('active'); $('.header-search').slideToggle(); }); /* MOBILE MENU */ var button = $('.header__mobile-nav-button'); var menu = $('.header__mobile-nav-menu'); var submenu = $('.header__mobile-nav-menu .menu-item-has-children > a'); var auth = $('.header__mobile-auth-btn'); var authMenu = $('#auth-menu'); button.click( function(){ $('.mobile-menu').addClass('active'); /* if (!menu.hasClass('openned')) { authMenu.slideUp().removeClass('openned'); auth.removeClass('active'); $(this).addClass('active'); menu.slideDown().addClass('openned'); } else { menu.slideUp().removeClass('openned'); submenu.siblings('.sub-menu').slideUp().removeClass('active'); $(this).removeClass('active'); submenu.removeClass('active'); }*/ }); submenu.click( function(e){ if (!$(this).siblings('.sub-menu').hasClass('active')) { $(this).siblings('.sub-menu').slideDown().addClass('active'); $(this).addClass('active'); return false; } }); auth.click( function(e){ e.preventDefault(); if (!authMenu.hasClass('openned')) { menu.slideUp().removeClass('openned'); submenu.siblings('.sub-menu').slideUp().removeClass('active'); button.removeClass('active'); submenu.removeClass('active'); $(this).addClass('active'); authMenu.slideDown().addClass('openned'); } else { authMenu.slideUp().removeClass('openned'); $(this).removeClass('active'); } }); /* END MOBILE MENU */ /* resize hero START */ var rtime; var timeout = false; var delta = 200; $(window).on("load resize", function(){ rtime = new Date(); if (timeout === false) { timeout = true; setTimeout(resizeend, delta); } }); function resizeend() { if (new Date() - rtime < delta) { setTimeout(resizeend, delta); } else { timeout = false; hero_size(); hero_static_size(); } } function hero_size() { var wh = $(window).height(); var th = $(document).find(".top-menu").outerHeight(); var hh = $(document).find(".header").outerHeight(); var sh = $(document).find(".scroll-down").outerHeight(); var offset = 30; var hero = $(".hero"); var hero_block = $(document).find(".hero-block"); var hero_content = $(".hero__info"); //var min_size = hero_content.outerHeight() + 130; var min_size = hero_content.outerHeight(); //hero.removeClass("auto"); //if($(window).width() > 1240 && $(window).height() < 970) { var total_h = wh - th - hh - sh - offset; hero.removeClass("auto"); hero_block.css("min-height", total_h); if(window.location.hash) { var hash = window.location.hash; console.log(hash); setTimeout(function(){ var hh = $(document).find('.header').outerHeight(); $('html, body').animate({ scrollTop: $(hash).offset().top }, 0, 'swing'); }, 10); } //} /* if(hero.outerHeight() <= min_size || $(window).height() < 375) { hero.addClass("auto"); }*/ } function hero_static_size() { var wh = $(window).height(); var th = $(document).find(".top-menu").outerHeight(); var hh = $(document).find(".header").outerHeight(); var sh = $(document).find(".scroll-down").outerHeight(); var hero = $(".hero-static"); var hero_block = $(".hero-static__block-wrapper"); var hero_content = $(".hero-static__block"); var min_size = hero_content.outerHeight(); //hero.removeClass("auto"); if($(window).width() > 1240 && $(window).height() < 940) { var total_h = $(window).height() - th - hh; hero.removeClass("auto"); hero_block.css("min-height", total_h); } } /* resize hero END */ var hero_slider = new Swiper ('.hero .swiper-container', { slidesPerView: 1, autoHeight: true, speed: 1000, autoplay: { delay: 1500, disableOnInteraction: false }, pagination: { el: '.hero__pagination', type: 'bullets', clickable: true }, navigation: { nextEl: '.hero-nav__arrow_next', prevEl: '.hero-nav__arrow_prev', }, effect: 'fade', /* fadeEffect: { crossFade: true },*/ }); var hero_static_slider = new Swiper ('.hero-static .swiper-container', { slidesPerView: 1, autoplay: { delay: 2000, }, effect: 'fade', }); var brands_slider_default = new Swiper ($('.brands-list_default .brands-list__slider'), { slidesPerView: 6, spaceBetween: 10, loop: true, navigation: { nextEl: $('.brands-list_default .brands-list__arrow_next'), prevEl: $('.brands-list_default .brands-list__arrow_prev'), disabledClass: 'brands-list__arrow_disabled' }, breakpoints: { 1025: { slidesPerView: 6, }, 761: { slidesPerView: 3, }, 481: { slidesPerView: 2, }, 0: { slidesPerView: 2, } } }); var brands_slider_card = new Swiper ($('.brands-icons__list_scorecard .brands-icons__list-slider'), { slidesPerView: 5, spaceBetween: 10, loop: true, centeredSlides: true, autoplay: { delay: 2500, disableOnInteraction: false, }, navigation: { nextEl: $('.brands-icons__list_scorecard .brands-icons__list__arrow_next'), prevEl: $('.brands-icons__list_scorecard .brands-icons__list__arrow_prev'), disabledClass: 'brands-icons__list__arrow_disabled' }, breakpoints: { 1025: { slidesPerView: 5, }, 761: { slidesPerView: 3, }, 481: { slidesPerView: 2, }, 0: { slidesPerView: 2, } } }); var hero_slider = new Swiper ('.documents .swiper-container', { watchOverflow: true, slidesPerView: 3, slidesPerGroup: 3, pagination: { el: '.documents__pagination', type: 'bullets', clickable: true }, navigation: { nextEl: $('.documents__nav-next'), prevEl: $('.documents__nav-prev'), disabledClass: 'disabled' }, breakpoints: { 1025: { slidesPerView: 3, }, 768: { slidesPerView: 2, }, 0: { slidesPerView: 1, } } }); $(".play-button").on("click", function() { video = $(this).next("video"); if(!$(this).hasClass("active")) { $(video).stop().trigger('play'); } else { $(video).stop().trigger('pause'); } $(this).toggleClass("active"); }); $(document).on('click', '.accordeon-item__title', function(){ var block = $(this).closest('.accordeon-item'); block.toggleClass('active'); block.find('.accordeon-item__info').stop().slideToggle(); }); window.onscroll = function() {barFunction()}; function barFunction() { var winScroll = document.body.scrollTop || document.documentElement.scrollTop; var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; var scrolled = (winScroll / height) * 100; document.getElementById("progress-bar").style.width = scrolled + "%"; } $(document).on('click', '.offer-link_form', function(){ $(document).find('.offer-form').slideToggle(); return false; }); $(document).on('click', '.quote__description-toggle', function(){ $(this).toggleClass('active'); $(this).next('.quote__description').stop().slideToggle(); }); /* kurochka natoptala END */ $(document).on('click', '.wpcf7-mail-sent-ok', function(){ $(this).removeClass('wpcf7-mail-sent-ok'); $(document).find('.wpcf7-form').removeClass('sent'); $(document).find('select').removeClass('changed'); $(document).find('select').prop('selectedIndex',0); }); $(document).on('click', '.link-title>a', function(){ return false; }); $(document).on('click', '*[data-submenu]', function(){ var _menu = $(this).attr('data-submenu'); console.log('*[data-menu="'+_menu+'"]'); $(document).find('*[data-menu="'+_menu+'"]').addClass('active'); return false; }); $(document).on('click', '.mobile-menu__close', function(){ $(document).find('.mobile-menu').removeClass('active'); }); $(document).on('click', '.mobile-menu__block-close', function(){ $(this).closest('.mobile-menu__block').removeClass('active'); }); }); $(window).load(function(){ $('.kfar__list').masonry({ // options itemSelector: '.kfar-item', //columnWidth: 200 }); $(document).find('.accordeon-item__info').hide(); }); /* kurochka natoptala START */ function showSvgIntoView(item, keylist) { var lastViewId = 0; keylist.forEach(function (el, i) { setTimeout(function(){ $(item[el]).css('opacity', '1'); }, i*200); }); } $(window).load(function(){ if ($('#Pattes').length) { var item1 = $('#Pattes path'); var keyItem1 = Object.keys($('#Pattes path')); showSvgIntoView(item1, keyItem1); } if(window.location.hash) { var hash = window.location.hash; } }); $(document).ready(function(){ $(window).scroll(function() { if ($(this).scrollTop() > 220) { $('.back-to-top').css('opacity', 1); } else { $('.back-to-top').css('opacity', 0); } }); });