-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.min.js
More file actions
1 lines (1 loc) · 2.67 KB
/
Copy pathscript.min.js
File metadata and controls
1 lines (1 loc) · 2.67 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 c(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 i(){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",c)}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",c)}),o&&o.addEventListener("click",i),r.forEach(function(e){e.addEventListener("click",i)}),document.addEventListener("keydown",function(e){"Escape"===e.key&&n&&n.classList.contains("is-open")&&i()});var a=document.getElementById("hero");window.addEventListener("scroll",function(){e&&((a?a.getBoundingClientRect().bottom:0)<0?e.classList.add("nav--scrolled"):e.classList.remove("nav--scrolled"))},{passive:!0});var s=document.querySelectorAll(".nav-link"),d=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&s.forEach(function(t){t.classList.remove("active"),t.getAttribute("href")==="#"+e.target.id&&t.classList.add("active")})})},{rootMargin:"-40% 0px -55% 0px"});if(["constat","approche","offres","preuves"].forEach(function(e){var t=document.getElementById(e);t&&d.observe(t)}),!window.matchMedia("(prefers-reduced-motion: reduce)").matches){var l=document.querySelectorAll(".card, .offre-card, .metric, .verbatim, .pillar, .faq-item");l.forEach(function(e){e.classList.add("reveal")});var u=new IntersectionObserver(function(e){e.forEach(function(e){e.isIntersecting&&(e.target.classList.add("visible"),u.unobserve(e.target))})},{rootMargin:"0px 0px -60px 0px"});l.forEach(function(e){u.observe(e)})}var f=document.querySelectorAll(".faq-item");f.forEach(function(e){e.addEventListener("toggle",function(){e.open&&f.forEach(function(t){t!==e&&t.open&&(t.open=!1)})})});var v=document.querySelector(".ticker-wrapper"),m=document.getElementById("ticker-pause");if(m&&v){var p=m.querySelector(".ticker-pause-label");m.addEventListener("click",function(){var e=v.classList.toggle("ticker-paused");m.classList.toggle("is-paused",e),m.setAttribute("aria-pressed",String(e)),p&&(p.textContent=e?"Reprendre":"Pause")})}}();