js bouton presentation equipe en eng

This commit is contained in:
2026-03-12 12:22:07 +01:00
parent 5d208da095
commit d8eb9b0e4a
3 changed files with 33 additions and 9 deletions

View File

@@ -496,10 +496,19 @@ document.addEventListener('DOMContentLoaded', function () {
const photo = document.querySelector('.field_field_equipe_photo'); const photo = document.querySelector('.field_field_equipe_photo');
const pres = document.querySelector('.field_field_equipe_presentation'); const pres = document.querySelector('.field_field_equipe_presentation');
const isEnglish = window.location.pathname.startsWith('/en/');
const openText = isEnglish
? "LEARN MORE ABOUT THE TEAM"
: "EN SAVOIR PLUS SUR L'ÉQUIPE";
const closeText = isEnglish
? "CLOSE THE TEAM PRESENTATION"
: "FERMER LA PRÉSENTATION DE L'ÉQUIPE";
if (!photo || !pres) return; if (!photo || !pres) return;
// 🔒 Forcer l'état FERMÉ au chargement // Forcer l'état FERMÉ au chargement
photo.classList.remove('is-open'); photo.classList.remove('is-open');
pres.classList.remove('is-open'); pres.classList.remove('is-open');
@@ -519,7 +528,8 @@ document.addEventListener('DOMContentLoaded', function () {
// 3. Création du bouton // 3. Création du bouton
const btn = document.createElement('button'); const btn = document.createElement('button');
btn.className = 'btn-equipe-toggle'; btn.className = 'btn-equipe-toggle';
btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE"; btn.textContent = openText;
// btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE";
btn.setAttribute('aria-expanded', 'false'); btn.setAttribute('aria-expanded', 'false');
// Insertion du bouton juste après le panel (et plus après "pres") // Insertion du bouton juste après le panel (et plus après "pres")
@@ -540,7 +550,8 @@ document.addEventListener('DOMContentLoaded', function () {
const fullHeight = panel.scrollHeight; // inclut photo + texte const fullHeight = panel.scrollHeight; // inclut photo + texte
panel.style.maxHeight = fullHeight + 'px'; panel.style.maxHeight = fullHeight + 'px';
btn.textContent = "FERMER LA PRÉSENTATION DE L'ÉQUIPE"; btn.textContent = closeText;
// btn.textContent = "FERMER LA PRÉSENTATION DE L'ÉQUIPE";
btn.setAttribute('aria-expanded', 'true'); btn.setAttribute('aria-expanded', 'true');
} }
@@ -555,7 +566,8 @@ document.addEventListener('DOMContentLoaded', function () {
pres.classList.remove('is-open'); pres.classList.remove('is-open');
}); });
btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE"; btn.textContent = openText;
// btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE";
btn.setAttribute('aria-expanded', 'false'); btn.setAttribute('aria-expanded', 'false');
} }

File diff suppressed because one or more lines are too long

View File

@@ -438,10 +438,19 @@ document.addEventListener('DOMContentLoaded', function () {
const photo = document.querySelector('.field_field_equipe_photo'); const photo = document.querySelector('.field_field_equipe_photo');
const pres = document.querySelector('.field_field_equipe_presentation'); const pres = document.querySelector('.field_field_equipe_presentation');
const isEnglish = window.location.pathname.startsWith('/en/');
const openText = isEnglish
? "LEARN MORE ABOUT THE TEAM"
: "EN SAVOIR PLUS SUR L'ÉQUIPE";
const closeText = isEnglish
? "CLOSE THE TEAM PRESENTATION"
: "FERMER LA PRÉSENTATION DE L'ÉQUIPE";
if (!photo || !pres) return; if (!photo || !pres) return;
// 🔒 Forcer l'état FERMÉ au chargement // Forcer l'état FERMÉ au chargement
photo.classList.remove('is-open'); photo.classList.remove('is-open');
pres.classList.remove('is-open'); pres.classList.remove('is-open');
@@ -461,7 +470,8 @@ document.addEventListener('DOMContentLoaded', function () {
// 3. Création du bouton // 3. Création du bouton
const btn = document.createElement('button'); const btn = document.createElement('button');
btn.className = 'btn-equipe-toggle'; btn.className = 'btn-equipe-toggle';
btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE"; btn.textContent = openText;
// btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE";
btn.setAttribute('aria-expanded', 'false'); btn.setAttribute('aria-expanded', 'false');
// Insertion du bouton juste après le panel (et plus après "pres") // Insertion du bouton juste après le panel (et plus après "pres")
@@ -482,7 +492,8 @@ document.addEventListener('DOMContentLoaded', function () {
const fullHeight = panel.scrollHeight; // inclut photo + texte const fullHeight = panel.scrollHeight; // inclut photo + texte
panel.style.maxHeight = fullHeight + 'px'; panel.style.maxHeight = fullHeight + 'px';
btn.textContent = "FERMER LA PRÉSENTATION DE L'ÉQUIPE"; btn.textContent = closeText;
// btn.textContent = "FERMER LA PRÉSENTATION DE L'ÉQUIPE";
btn.setAttribute('aria-expanded', 'true'); btn.setAttribute('aria-expanded', 'true');
} }
@@ -497,7 +508,8 @@ document.addEventListener('DOMContentLoaded', function () {
pres.classList.remove('is-open'); pres.classList.remove('is-open');
}); });
btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE"; btn.textContent = openText;
// btn.textContent = "EN SAVOIR PLUS SUR L'ÉQUIPE";
btn.setAttribute('aria-expanded', 'false'); btn.setAttribute('aria-expanded', 'false');
} }