modif menu, suppression ornements
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
delay += opacityDelay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Toggle menu visibility on hamburger click
|
||||
hamburgerBtn.addEventListener("click", function(event) {
|
||||
event.stopPropagation();
|
||||
@@ -57,8 +57,8 @@
|
||||
}, 700);
|
||||
toggleMenuItems('hide');
|
||||
} else {
|
||||
menu.style.display = "flex";
|
||||
toggleMenuItems('show');
|
||||
menu.style.display = "flex";
|
||||
toggleMenuItems('show');
|
||||
}
|
||||
setTimeout(() => {
|
||||
menu.classList.toggle("active");
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Close menu when clicking outside of the menu
|
||||
document.addEventListener("click", function(event) {
|
||||
const isHamburgerClicked = event.target === hamburgerBtn;
|
||||
@@ -98,7 +98,7 @@
|
||||
} else {
|
||||
fluoButtons = document.querySelectorAll('.liens_fixed > div > div:not(.visually-hidden), .file_fixed > div > div');
|
||||
}
|
||||
|
||||
|
||||
let footer = document.querySelector('#footer_top');
|
||||
function positionFluoLinks() {
|
||||
for (let i = fluoButtons.length; i > 0 ; i--) {
|
||||
@@ -107,7 +107,7 @@
|
||||
if (footer.offsetTop < window.innerHeight + window.scrollY && i === fluoButtons.length) {
|
||||
fluoButtons[i - 1].style.bottom = `${window.innerHeight - footer.offsetTop + window.scrollY + 30}px`;
|
||||
} else {
|
||||
fluoButtons[i - 1].style.bottom = i === fluoButtons.length ? '30px' : `${prevButtonBottom + prevButtonHeight + 15}px`;
|
||||
fluoButtons[i - 1].style.bottom = i === fluoButtons.length ? '30px' : `${prevButtonBottom + prevButtonHeight + 15}px`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,291 +182,46 @@
|
||||
}
|
||||
|
||||
//
|
||||
// Effets parallax
|
||||
// Sous Menu display on hover
|
||||
//
|
||||
|
||||
let ornements, scrollHeight;
|
||||
function getElementsAndPositions() {
|
||||
scrollHeight = document.body.scrollHeight;
|
||||
if (currentPage === 'fullpage') {
|
||||
ornements = {
|
||||
topUnderFirst : {
|
||||
el : document.querySelector('.ornements_top_under > div:first-of-type'),
|
||||
values : window.innerWidth < 1080 ? { left : -45, top : -3 } : { left : -50, top : 1 },
|
||||
mobileValues : { left : -45, top : -3 }
|
||||
},
|
||||
topUnderSecond : {
|
||||
el : document.querySelector('.ornements_top_under > div:last-of-type'),
|
||||
values : window.innerWidth < 1080 ? { left : -60, top : 0 } : { left : -56.5, top : 6 },
|
||||
mobileValues : { left : -60, top : 0 }
|
||||
},
|
||||
topOver : {
|
||||
el : document.querySelector('.ornements_top_over'),
|
||||
values : { left : -36, top : -20 },
|
||||
mobileValues : { right : -55, top : -5 }
|
||||
},
|
||||
bottomFirst : {
|
||||
el : document.querySelector('.ornements_bottom_over > div:first-of-type'),
|
||||
values : window.innerWidth < 1080 ? { left : -8, bottom : -4 } : { left : -20, bottom : 6 },
|
||||
mobileValues : { left : -8, bottom : -4 }
|
||||
},
|
||||
bottomSecond : {
|
||||
el : document.querySelector('.ornements_bottom_over > div:last-of-type'),
|
||||
values : window.innerWidth < 1080 ? { left : 18, bottom : -11 } : { left : 25, bottom : -9 },
|
||||
mobileValues : { left : -3, bottom : -15 }
|
||||
}
|
||||
};
|
||||
} else if (currentPage === 'home') {
|
||||
ornements = {
|
||||
carouselTop : {
|
||||
el : document.querySelector('.ornements_carousel_top'),
|
||||
values : window.innerWidth < 1080 ? { left : 3, top : -25 } : { left : -10, top : 20 },
|
||||
// mobileValues : {}
|
||||
},
|
||||
carouselBottomFirst : {
|
||||
el : document.querySelector('.ornements_carousel_bottom > div:first-of-type'),
|
||||
values : window.innerWidth < 1080 ? { left : 0, top : 35 } : { left : 0, top : -16 },
|
||||
// mobileValues : {}
|
||||
},
|
||||
carouselBottomSecond : {
|
||||
el : document.querySelector('.ornements_carousel_bottom > div:nth-of-type(2)'),
|
||||
values : window.innerWidth < 1080 ? { left : 12, top : 40 } : { left : 4, top : -8 },
|
||||
// mobileValues : {}
|
||||
},
|
||||
presentationLeftFirst : {
|
||||
el : document.querySelector('.ornements_presentation_left > div:first-of-type'),
|
||||
values : { left : -20, bottom : -8 },
|
||||
mobileValues : { left : -20, bottom : -8 }
|
||||
},
|
||||
presentationLeftSecond : {
|
||||
el : document.querySelector('.ornements_presentation_left > div:nth-of-type(2)'),
|
||||
values : { left : -21, bottom : -3 },
|
||||
mobileValues : { left : -10, bottom : -5 }
|
||||
},
|
||||
presentationLeftThird : {
|
||||
el : document.querySelector('.ornements_presentation_left > div:nth-of-type(3)'),
|
||||
values : { left : -22, bottom : -3 },
|
||||
mobileValues : { left : -22, bottom : -3 }
|
||||
},
|
||||
presentationRightFirst : {
|
||||
el : document.querySelector('.ornements_presentation_right > div:first-of-type'),
|
||||
values : { right : -6, bottom : -3 },
|
||||
mobileValues : { right : -15, bottom : -6 }
|
||||
},
|
||||
presentationRightSecond : {
|
||||
el : document.querySelector('.ornements_presentation_right > div:nth-of-type(2)'),
|
||||
values : { right : -12, bottom : -12 },
|
||||
mobileValues : { right : -12, bottom : -12 }
|
||||
},
|
||||
consultationLeftFirst : {
|
||||
el : document.querySelector('.ornements_consultation_left > div:first-of-type'),
|
||||
values : window.innerWidth < 1080 ? { left : -30, bottom : -10 } : { left : 0, bottom : 5 },
|
||||
mobileValues : { left : -30, bottom : -10 }
|
||||
},
|
||||
consultationLeftSecond : {
|
||||
el : document.querySelector('.ornements_consultation_left > div:nth-of-type(2)'),
|
||||
values : window.innerWidth < 1080 ? { left : -12, top : 0 } : { left : -20, top : -5 },
|
||||
mobileValues : { left : -12, top : 0 }
|
||||
},
|
||||
consultationRightFirst : {
|
||||
el : document.querySelector('.ornements_consultation_right > div:first-of-type'),
|
||||
values : window.innerWidth < 1080 ? { right : -8, bottom : -2 } : { right : -3, bottom : 6 },
|
||||
mobileValues : { right : -8, bottom : -2 }
|
||||
},
|
||||
consultationRightSecond : {
|
||||
el : document.querySelector('.ornements_consultation_right > div:nth-of-type(2)'),
|
||||
values : { right : -4, bottom : 3 },
|
||||
mobileValues : { right : -4, bottom : 0 }
|
||||
}
|
||||
};
|
||||
}
|
||||
const programLink = document.querySelector("#block-erabletheme-navigationprincipale ul li:first-of-type");
|
||||
const programSubmenu = document.querySelector("#block-erabletheme-leprogramme");
|
||||
let isSubmenuOpen = false;
|
||||
|
||||
function showSubmenu() {
|
||||
programLink.classList.add("submenu-open");
|
||||
const rect = programLink.getBoundingClientRect();
|
||||
programSubmenu.style.top = `${rect.bottom}px`;
|
||||
programSubmenu.style.left = `${rect.left}px`;
|
||||
programSubmenu.style.display = "block";
|
||||
|
||||
programSubmenu.style.display = "block";
|
||||
setTimeout(() => {
|
||||
programSubmenu.style.maxHeight = "50vh";
|
||||
}, 10)
|
||||
|
||||
isSubmenuOpen = true;
|
||||
}
|
||||
|
||||
function moveElementsOnScroll() {
|
||||
if (currentPage === 'fullpage') {
|
||||
ornements.topOver.el.style.left = `${ornements.topOver.values.left * (window.innerWidth / 100) - window.scrollY / 4}px`;
|
||||
ornements.topOver.el.style.top = `${ornements.topOver.values.top * (window.innerHeight / 100) + window.scrollY / 5}px`;
|
||||
|
||||
ornements.topUnderFirst.el.style.left = `${ornements.topUnderFirst.values.left * (window.innerWidth / 100) - window.scrollY / 5}px`;
|
||||
ornements.topUnderFirst.el.style.top = `${ornements.topUnderFirst.values.top * (window.innerHeight / 100) + window.scrollY / 1.3}px`;
|
||||
|
||||
ornements.topUnderSecond.el.style.left = `${ornements.topUnderSecond.values.left * (window.innerWidth / 100) - window.scrollY / 8}px`;
|
||||
ornements.topUnderSecond.el.style.top = `${ornements.topUnderSecond.values.top * (window.innerHeight / 100) + window.scrollY / 1.2}px`;
|
||||
|
||||
ornements.bottomFirst.el.style.right = `${ornements.bottomFirst.values.left * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 5)}px`;
|
||||
|
||||
ornements.bottomSecond.el.style.bottom = `${ornements.bottomFirst.values.bottom * (window.innerHeight / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 2)}px`;
|
||||
} else if (currentPage === 'home') {
|
||||
ornements.carouselTop.el.style.left = `${ornements.carouselTop.values.left * (window.innerWidth / 100) - window.scrollY / 4}px`;
|
||||
ornements.carouselTop.el.style.top = `${ornements.carouselTop.values.top * (window.innerHeight / 100) + window.scrollY / 8}px`;
|
||||
|
||||
ornements.carouselBottomFirst.el.style.left = `${ornements.carouselBottomFirst.values.left * (window.innerWidth / 100) + window.scrollY / 5}px`;
|
||||
ornements.carouselBottomFirst.el.style.top = `${ornements.carouselBottomFirst.values.top * (window.innerHeight / 100) + window.scrollY / 1.3}px`;
|
||||
|
||||
ornements.carouselBottomSecond.el.style.left = `${ornements.carouselBottomSecond.values.left * (window.innerWidth / 100) - window.scrollY / 8}px`;
|
||||
ornements.carouselBottomSecond.el.style.top = `${ornements.carouselBottomSecond.values.top * (window.innerHeight / 100) + window.scrollY / 1.2}px`;
|
||||
|
||||
|
||||
ornements.presentationLeftFirst.el.style.left = `${ornements.presentationLeftFirst.values.left * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 5)}px`;
|
||||
|
||||
ornements.presentationLeftSecond.el.style.left = `${ornements.presentationLeftSecond.values.left * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 3)}px`;
|
||||
|
||||
ornements.presentationLeftThird.el.style.left = `${ornements.presentationLeftThird.values.left * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 2)}px`;
|
||||
|
||||
|
||||
ornements.presentationRightFirst.el.style.right = `${ornements.presentationRightFirst.values.right * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 5)}px`;
|
||||
|
||||
ornements.presentationRightSecond.el.style.right = `${ornements.presentationRightSecond.values.right * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 3)}px`;
|
||||
|
||||
|
||||
|
||||
|
||||
ornements.consultationLeftFirst.el.style.left = `${ornements.consultationLeftFirst.values.left * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 6)}px`;
|
||||
|
||||
ornements.consultationLeftSecond.el.style.left = `${ornements.consultationLeftSecond.values.left * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 2)}px`;
|
||||
|
||||
|
||||
ornements.consultationRightFirst.el.style.right = `${ornements.consultationRightFirst.values.right * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 4)}px`;
|
||||
|
||||
ornements.consultationRightSecond.el.style.right = `${ornements.consultationRightSecond.values.right * (window.innerWidth / 100) - ((scrollHeight - (window.scrollY + window.innerHeight)) / 2)}px`;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function resetElementsPosition() {
|
||||
if (currentPage === 'fullpage') {
|
||||
|
||||
ornements.topUnderFirst.el.style.left = `${ornements.topUnderFirst.values.left}vw`;
|
||||
ornements.topUnderFirst.el.style.top = `${ornements.topUnderFirst.values.top}vh`;
|
||||
|
||||
ornements.topUnderSecond.el.style.left = `${ornements.topUnderSecond.values.left}vw`;
|
||||
ornements.topUnderSecond.el.style.top = `${ornements.topUnderSecond.values.top}vh`;
|
||||
|
||||
ornements.topOver.el.style.left = `${ornements.topOver.values.left}vw`;
|
||||
ornements.topOver.el.style.top = `${ornements.topOver.values.top}vh`;
|
||||
|
||||
ornements.bottomFirst.el.style.left = "unset",
|
||||
ornements.bottomFirst.el.style.right = `${ornements.bottomFirst.values.left}vw`;
|
||||
ornements.bottomFirst.el.style.bottom = `${ornements.bottomFirst.values.bottom}vh`;
|
||||
|
||||
ornements.bottomSecond.el.style.top = "unset";
|
||||
ornements.bottomSecond.el.style.left = `${ornements.bottomSecond.values.left}vw`;
|
||||
ornements.bottomSecond.el.style.bottom = `${ornements.bottomSecond.values.bottom}vh`;
|
||||
|
||||
} else if (currentPage === 'home') {
|
||||
|
||||
ornements.carouselTop.el.style.left = `${ornements.carouselTop.values.left}vw`;
|
||||
ornements.carouselTop.el.style.top = `${ornements.carouselTop.values.top}vh`;
|
||||
|
||||
ornements.carouselBottomFirst.el.style.left = `${ornements.carouselBottomFirst.values.left}vw`;
|
||||
ornements.carouselBottomFirst.el.style.top = `${ornements.carouselBottomFirst.values.top}vh`;
|
||||
|
||||
ornements.carouselBottomSecond.el.style.left = `${ornements.carouselBottomSecond.values.left}vw`;
|
||||
ornements.carouselBottomSecond.el.style.top = `${ornements.carouselBottomSecond.values.top}vh`;
|
||||
|
||||
ornements.presentationLeftFirst.el.style.left = `${ornements.presentationLeftFirst.values.left}vw`;
|
||||
ornements.presentationLeftFirst.el.style.bottom = `${ornements.presentationLeftFirst.values.bottom}vh`;
|
||||
|
||||
ornements.presentationLeftSecond.el.style.left = `${ornements.presentationLeftSecond.values.left}vw`;
|
||||
ornements.presentationLeftSecond.el.style.bottom = `${ornements.presentationLeftSecond.values.bottom}vh`;
|
||||
|
||||
ornements.presentationLeftThird.el.style.left = `${ornements.presentationLeftThird.values.left}vw`;
|
||||
ornements.presentationLeftThird.el.style.bottom = `${ornements.presentationLeftThird.values.bottom}vh`;
|
||||
|
||||
ornements.presentationRightFirst.el.style.right = `${ornements.presentationRightFirst.values.right}vw`;
|
||||
ornements.presentationRightFirst.el.style.bottom = `${ornements.presentationRightFirst.values.bottom}vh`;
|
||||
|
||||
ornements.presentationRightSecond.el.style.right = `${ornements.presentationRightSecond.values.right}vw`;
|
||||
ornements.presentationRightSecond.el.style.bottom = `${ornements.presentationRightSecond.values.bottom}vh`;
|
||||
|
||||
ornements.consultationLeftFirst.el.style.left = `${ornements.consultationLeftFirst.values.left}vw`;
|
||||
ornements.consultationLeftFirst.el.style.bottom = `${ornements.consultationLeftFirst.values.bottom}vh`;
|
||||
|
||||
ornements.consultationLeftSecond.el.style.left = `${ornements.consultationLeftSecond.values.left}vw`;
|
||||
ornements.consultationLeftSecond.el.style.top = `${ornements.consultationLeftSecond.values.top}vh`;
|
||||
|
||||
ornements.consultationRightFirst.el.style.right = `${ornements.consultationRightFirst.values.right}vw`;
|
||||
ornements.consultationRightFirst.el.style.bottom = `${ornements.consultationRightFirst.values.bottom}vh`;
|
||||
|
||||
ornements.consultationRightSecond.el.style.right = `${ornements.consultationRightSecond.values.right}vw`;
|
||||
ornements.consultationRightSecond.el.style.bottom = `${ornements.consultationRightSecond.values.bottom}vh`;
|
||||
}
|
||||
}
|
||||
|
||||
function resetMobileElementsPosition() {
|
||||
if (currentPage === 'fullpage') {
|
||||
|
||||
ornements.topUnderFirst.el.style.left = `${ornements.topUnderFirst.mobileValues.left}vw`;
|
||||
ornements.topUnderFirst.el.style.top = `${ornements.topUnderFirst.mobileValues.top}vh`;
|
||||
|
||||
ornements.topUnderSecond.el.style.left = `${ornements.topUnderSecond.mobileValues.left}vw`;
|
||||
ornements.topUnderSecond.el.style.top = `${ornements.topUnderSecond.mobileValues.top}vh`;
|
||||
|
||||
ornements.topOver.el.style.left = "unset";
|
||||
ornements.topOver.el.style.right = `${ornements.topOver.mobileValues.right}vw`;
|
||||
ornements.topOver.el.style.top = `${ornements.topOver.mobileValues.top}vh`;
|
||||
|
||||
ornements.bottomFirst.el.style.left = "unset",
|
||||
ornements.bottomFirst.el.style.right = `${ornements.bottomFirst.mobileValues.left}vw`;
|
||||
ornements.bottomFirst.el.style.bottom = `${ornements.bottomFirst.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.bottomSecond.el.style.top = "unset";
|
||||
ornements.bottomSecond.el.style.left = `${ornements.bottomSecond.mobileValues.left}vw`;
|
||||
ornements.bottomSecond.el.style.bottom = `${ornements.bottomSecond.mobileValues.bottom}vh`;
|
||||
|
||||
} else if (currentPage === 'home') {
|
||||
|
||||
ornements.presentationLeftFirst.el.style.left = `${ornements.presentationLeftFirst.mobileValues.left}vw`;
|
||||
ornements.presentationLeftFirst.el.style.bottom = `${ornements.presentationLeftFirst.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.presentationLeftSecond.el.style.left = `${ornements.presentationLeftSecond.mobileValues.left}vw`;
|
||||
ornements.presentationLeftSecond.el.style.bottom = `${ornements.presentationLeftSecond.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.presentationLeftThird.el.style.left = `${ornements.presentationLeftThird.mobileValues.left}vw`;
|
||||
ornements.presentationLeftThird.el.style.bottom = `${ornements.presentationLeftThird.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.presentationRightFirst.el.style.right = `${ornements.presentationRightFirst.mobileValues.right}vw`;
|
||||
ornements.presentationRightFirst.el.style.bottom = `${ornements.presentationRightFirst.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.presentationRightSecond.el.style.right = `${ornements.presentationRightSecond.mobileValues.right}vw`;
|
||||
ornements.presentationRightSecond.el.style.bottom = `${ornements.presentationRightSecond.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.consultationLeftFirst.el.style.left = `${ornements.consultationLeftFirst.mobileValues.left}vw`;
|
||||
ornements.consultationLeftFirst.el.style.bottom = `${ornements.consultationLeftFirst.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.consultationLeftSecond.el.style.left = `${ornements.consultationLeftSecond.mobileValues.left}vw`;
|
||||
ornements.consultationLeftSecond.el.style.top = `${ornements.consultationLeftSecond.mobileValues.top}vh`;
|
||||
|
||||
ornements.consultationRightFirst.el.style.right = `${ornements.consultationRightFirst.mobileValues.right}vw`;
|
||||
ornements.consultationRightFirst.el.style.bottom = `${ornements.consultationRightFirst.mobileValues.bottom}vh`;
|
||||
|
||||
ornements.consultationRightSecond.el.style.right = `${ornements.consultationRightSecond.mobileValues.right}vw`;
|
||||
ornements.consultationRightSecond.el.style.bottom = `${ornements.consultationRightSecond.mobileValues.bottom}vh`;
|
||||
}
|
||||
}
|
||||
|
||||
function setupParallax() {
|
||||
getElementsAndPositions();
|
||||
resetElementsPosition();
|
||||
window.addEventListener("scroll", moveElementsOnScroll);
|
||||
}
|
||||
|
||||
if (currentPage) {
|
||||
if (window.innerWidth > 760) setupParallax();
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
window.scrollTo(0, 0);
|
||||
window.removeEventListener("scroll", moveElementsOnScroll);
|
||||
if (window.innerWidth > 760) {
|
||||
setupParallax();
|
||||
} else if (ornements) {
|
||||
resetMobileElementsPosition();
|
||||
function hideSubmenu() {
|
||||
programLink.classList.remove("submenu-open");
|
||||
programSubmenu.style.maxHeight = "0px";
|
||||
isSubmenuOpen = false;
|
||||
setTimeout(() => {
|
||||
if (!isSubmenuOpen) {
|
||||
programSubmenu.style.display = "none";
|
||||
}
|
||||
});
|
||||
}, 600);
|
||||
}
|
||||
|
||||
programLink.addEventListener("mouseenter", showSubmenu);
|
||||
programLink.addEventListener("mouseleave", hideSubmenu);
|
||||
|
||||
programSubmenu.addEventListener("mouseenter", showSubmenu);
|
||||
programSubmenu.addEventListener("mouseleave", hideSubmenu);
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} (Drupal));
|
||||
|
Reference in New Issue
Block a user