Repository navigation
Expand file tree
/
Copy pathscript.min.js
More file actions
1 lines (1 loc) · 2.7 KB
/
Copy pathscript.min.js
File metadata and controls
1 lines (1 loc) · 2.7 KB
1
!function(){"use strict";const e=document.getElementById("site-header"),t=document.getElementById("hamburger"),n=document.getElementById("mobile-nav"),o=document.getElementById("mobile-nav-close"),r=document.querySelectorAll(".mobile-nav-link, .mobile-nav-cta");function i(e){if("Tab"===e.key){var t=Array.from(n.querySelectorAll('button, a, [tabindex="0"]')),o=t[0],r=t[t.length-1];e.shiftKey?document.activeElement===o&&(e.preventDefault(),r.focus()):document.activeElement===r&&(e.preventDefault(),o.focus())}}function c(){n.classList.remove("is-open"),n.setAttribute("inert",""),t.classList.remove("is-open"),t.setAttribute("aria-expanded","false"),document.body.style.overflow="",t.focus(),document.removeEventListener("keydown",i)}t&&t.addEventListener("click",function(){n.classList.add("is-open"),n.removeAttribute("inert"),t.classList.add("is-open"),t.setAttribute("aria-expanded","true"),document.body.style.overflow="hidden",o.focus(),document.addEventListener("keydown",i)}),o&&o.addEventListener("click",c),r.forEach(function(e){e.addEventListener("click",c)}),document.addEventListener("keydown",function(e){"Escape"===e.key&&n&&n.classList.contains("is-open")&&c()});var s=document.getElementById("hero");window.addEventListener("scroll",function(){e&&((s?s.getBoundingClientRect().bottom:0)<0?e.classList.add("nav--scrolled"):e.classList.remove("nav--scrolled"))},{passive:!0});var a=document.querySelectorAll(".nav-link"),d=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&a.forEach(function(t){t.classList.remove("active"),t.getAttribute("href")==="#"+e.target.id&&t.classList.add("active")})})},{rootMargin:"-40% 0px -55% 0px"});["cas-client","offres","faq"].forEach(function(e){var t=document.getElementById(e);t&&d.observe(t)});var l=document.querySelectorAll(".faq-item");l.forEach(function(e){e.addEventListener("toggle",function(){e.open&&l.forEach(function(t){t!==e&&t.open&&(t.open=!1)})})});var u=document.querySelector(".ticker-wrapper"),f=document.getElementById("ticker-pause");if(f&&u){var v=f.querySelector(".ticker-pause-label");f.addEventListener("click",function(){var e=u.classList.toggle("ticker-paused");f.classList.toggle("is-paused",e),f.setAttribute("aria-pressed",String(e)),v&&(v.textContent=e?"Reprendre":"Pause")})}document.querySelectorAll(".offer").forEach(function(e){var t=e.querySelector(".offer-front"),n=e.querySelector(".offer-back"),o=t.querySelector(".offer-flip"),r=n.querySelector(".offer-flip");function i(i){e.classList.toggle("is-flipped",i),t.inert=i,n.inert=!i,o.setAttribute("aria-expanded",String(i)),(i?r:o).focus()}o.hidden=!1,r.hidden=!1,e.classList.add("is-ready"),n.inert=!0,o.addEventListener("click",function(){i(!0)}),r.addEventListener("click",function(){i(!1)})})}();