Notre guide vous accompagnera tout au long du parcours permanent de La Maison de La Vache qui rit pour découvrir l’histoire de La Vache qui rit et du groupe Bel. La visite se conclura par une séance de dégustation de produits Bel ainsi qu’un passage en boutique !
document.addEventListener('DOMContentLoaded', function() {
var stickyElement = document.querySelector('.container-sticky');
var parentElement = document.querySelector('.container_sommaire_ancre');
var footerElement = document.querySelector('.kg-footer__blocks');
var ancreListElement = document.getElementById('ancre_list');
function checkStickyPosition() {
if (!stickyElement || !footerElement || !parentElement) return;
var stickyRect = stickyElement.getBoundingClientRect();
var footerRect = footerElement.getBoundingClientRect();
var parentRect = parentElement.getBoundingClientRect();
// Get current scroll position from the top of the document
var scrollY = window.scrollY || window.pageYOffset;
// Distance from sticky element to the footer
var stickyBottom = stickyElement.offsetTop + stickyElement.offsetHeight;
var footerTop = footerElement.offsetTop;
// Add the sticky-stop class if the sticky element would overlap the footer
if (stickyBottom + scrollY > footerTop) {
stickyElement.classList.add('sticky-stop');
} else {
stickyElement.classList.remove('sticky-stop');
}
}
function updateResponsiveStyles() {
if (window.innerWidth <= 1200) {
// Supprimer l'ID 'ancre_list' pour les petits écrans
if (ancreListElement && ancreListElement.id) {
ancreListElement.removeAttribute('id');
console.log('1')
}
} else {
// Réappliquer l'ID si nécessaire sur les écrans plus grands
if (ancreListElement && !ancreListElement.id) {
ancreListElement.id='ancre_list' ;
}
}
}
// Appeler les fonctions au chargement de la page
checkStickyPosition();
updateResponsiveStyles();
// Réagir aux événements de défilement et de redimensionnement
window.addEventListener('scroll', checkStickyPosition);
window.addEventListener('resize', function() {
updateResponsiveStyles();
checkStickyPosition();
});
// Observer les changements de dimension pour appliquer les styles immédiatement
var resizeObserver=new ResizeObserver(function() {
updateResponsiveStyles();
});
resizeObserver.observe(document.body);
});