484 lines
12 KiB
JavaScript
484 lines
12 KiB
JavaScript
$(document).ready(function () {
|
|
$(
|
|
".mobile-menu__link:not(.mobile-menu__link_hassub), .mobile-menu__level .anchor-scroll"
|
|
).on("click", () => {
|
|
$(".mobile-menu").removeClass("active");
|
|
});
|
|
|
|
$(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 () {
|
|
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");
|
|
});
|
|
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();
|
|
|
|
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;
|
|
|
|
setTimeout(function () {
|
|
var hh = $(document).find(".header").outerHeight();
|
|
$("html, body").animate(
|
|
{
|
|
scrollTop: $(hash).offset().top,
|
|
},
|
|
0,
|
|
"swing"
|
|
);
|
|
}, 10);
|
|
}
|
|
}
|
|
|
|
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();
|
|
|
|
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: false,
|
|
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",
|
|
});
|
|
|
|
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: 5,
|
|
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: 5,
|
|
},
|
|
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();
|
|
});
|
|
$(document).ready(function () {
|
|
$(".accordeon-item.opened")
|
|
.delay(3000)
|
|
.queue(function () {
|
|
$(this).addClass("active").find(".accordeon-item__info").slideDown();
|
|
});
|
|
});
|
|
|
|
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");
|
|
$(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");
|
|
});
|
|
});
|
|
|
|
let elemMas = document.querySelector(".kfar__list");
|
|
if (elemMas !== null) {
|
|
new Masonry(elemMas, {
|
|
// options
|
|
itemSelector: ".kfar-item",
|
|
});
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
$(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);
|
|
}
|
|
});
|
|
});
|
|
|
|
$(document).ready(function () {
|
|
$("body").on("click", ".flipbook", function (e) {
|
|
let iframe = $(this).find("iframe")[0];
|
|
$(iframe).attr("src", function (i, val) {
|
|
return val;
|
|
});
|
|
});
|
|
$(".contact-index button.textblock__info-btn").on("click", function (e) {
|
|
e.preventDefault();
|
|
var $target = $("#" + $(this).data("target"));
|
|
$(this).toggleClass("toggle");
|
|
if ($target) {
|
|
if ($target.css("display") == "flex") {
|
|
$target.slideUp();
|
|
} else {
|
|
$target.slideDown({
|
|
start: function () {
|
|
$(this).css({
|
|
display: "flex",
|
|
});
|
|
},
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
$(document).ready(function () {
|
|
// CTA Newsletter
|
|
$("#newsletter_cta").on("submit", function (e) {
|
|
e.preventDefault();
|
|
let email = $("#newsletter_cta_email");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: MYSCRIPT.ajaxurl,
|
|
data: {
|
|
email: email.val(),
|
|
action: "newsletterCta",
|
|
security: MYSCRIPT.security,
|
|
lang: MYSCRIPT.lang,
|
|
},
|
|
success: function (response, textStatus, jqXHR) {
|
|
let result = JSON.parse(response);
|
|
alert(result.message);
|
|
email.val("");
|
|
},
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
alert("Une erreur est survenue, veuillez recharger la page.");
|
|
email.val("");
|
|
},
|
|
});
|
|
});
|
|
});
|