harmonize header page
All checks were successful
Deploy / Deploy to Production (push) Successful in 10s

This commit is contained in:
Julie Blanc 2026-01-27 16:55:02 +01:00
parent 849b506c50
commit e6f62a62df
22 changed files with 302 additions and 229 deletions

View file

@ -1,8 +1,9 @@
export function initDropdowns(responsiveSmall) {
const dropdowns = document.querySelectorAll('.dropdown');
function updateBodyOverflow(isOpen) {
if (isOpen && window.innerWidth < responsiveSmall) {
function updateBodyOverflow(isOpen, dropdownElement = null) {
const isInMobileGroup = dropdownElement?.closest('.btn--group__mobile');
if (isOpen && window.innerWidth < responsiveSmall && isInMobileGroup) {
document.body.classList.add('is-hidden');
} else {
document.body.classList.remove('is-hidden');
@ -15,6 +16,8 @@ export function initDropdowns(responsiveSmall) {
if (!trigger) return;
// Empêche la fermeture au clic dans le contenu des dropdowns contenant .modal--share
if (dropdown.querySelector('.modal--share') && content) {
content.addEventListener('click', (e) => {
@ -54,7 +57,7 @@ export function initDropdowns(responsiveSmall) {
trigger.classList.toggle('is-selected');
// Gère l'overflow du body sur mobile
updateBodyOverflow(dropdown.classList.contains('is-open'));
updateBodyOverflow(dropdown.classList.contains('is-open'), dropdown);
});
});