“Le soir, lorsqu’elles auront jeté l’ancre sur un fond de bonne tenue, en matelots elles dormiront sur le plancher de leur voilier, dans la toile souple du foc et du spinnaker (…) tandis que les étoiles clignoteront au ciel. Le jour, les heures sont belles à vivre en costume de bain, la peau bronzée sentant le pain cuit. Lorsque le calme plat et que les voiles pendent lamentablement, elles lisent ensemble La fille aux yeux d’or de Balzac. Elles ont les mêmes goûts. ”
Ella Maillart fait ici référence à une navigation avec Hermine de Saussure.
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);
});