harmonize header page
All checks were successful
Deploy / Deploy to Production (push) Successful in 10s
All checks were successful
Deploy / Deploy to Production (push) Successful in 10s
This commit is contained in:
parent
849b506c50
commit
e6f62a62df
22 changed files with 302 additions and 229 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue