Do not hesitate to make an appointment directly in the agenda for more information.
.cta-mobile-only { display: none !important; }
@media (max-width: 767px) {
.cta-mobile-only { display: flex !important; }
}
let sticky = false
const resizeSidebar = () => {
let TOC = document.getElementById(« wpj-jtoc »)
stickIt()
if(!TOC) return;
let nextTOCels = document.querySelectorAll(« #wpj-jtoc ~ div »)
let windowHeight = window.innerHeight – 150
let calcHeight = 0
let TOCheight = 0
TOC.style.height = « auto »
nextTOCels.forEach(item => {
calcHeight += item.offsetHeight
})
calcHeight += TOC.offsetHeight
// on stick les éléments
if(calcHeight > windowHeight) {
sticky = true
if(TOC) {
TOCheight = TOC.offsetHeight – (calcHeight – windowHeight)
TOC.style.height = TOCheight + ‘px’;
TOC.style.overflowX = ‘auto’
TOC.style.overflowY = ‘scroll’
TOC.style.boxShadow = « rgba(128, 128, 128, 0.14) 0px 0px 16px 0px »
TOC.style.borderRadius = « 10px »
}
stickIt()
}
}
const stickIt = () => {
let TOC = document.getElementById(« wpj-jtoc »)
let nextTOCels = document.querySelectorAll(« #wpj-jtoc ~ div, .stick-it + div »)
let sidebar = document.getElementById(‘secondary’)
let scrollY = window.scrollY
let offsetHeight = 100;
let posTopTrigger = sidebar.offsetHeight – document.querySelector(‘.top-item’).offsetHeight
// Quand on voit apparaitre la section après l’article
// if(window.innerHeight – document.querySelector(‘.other_posts’).getBoundingClientRect().y > 30) {
// TOC.style.position = « relative »
// TOC.style.top = « 0px »
// TOC.style.marginTop = « auto »
// nextTOCels.forEach(item => {
// item.style.position = « relative »;
// item.style.top = ‘0’;
// })
// } else {
// TOC.style.position = « sticky »
if(TOC) {
TOC.style.marginTop = « 20px »
TOC.style.top = « 100px »
offsetHeight = TOC.offsetHeight + 20 + 100;
}
nextTOCels.forEach(item => {
item.style.position = « sticky »;
item.style.top = offsetHeight + ‘px’;
offsetHeight += item.offsetHeight
})
// }
}
window.addEventListener(« load », (event) => {
resizeSidebar()
})
window.setTimeout(() => {
resizeSidebar()
},1500)
window.addEventListener(« resize », (event) => {
window.setTimeout(() => {
resizeSidebar()
}, 500);
});
document.addEventListener(« scroll », (event) => {
stickIt()
})
// fonction d’auto-centering du scroll de la table des matières
let pos = 0
let TOCel = document.getElementById(‘wpj-jtoc’)
document.addEventListener(« scroll », (event) => {
if(!TOCel) return;
let scrollHeight = TOCel.scrollHeight
let TOCheight = TOCel.innerHeight
let center = TOCheight/2
if(!document.querySelector(‘.–jtoc-is-active’)) return;
pos = document.querySelector(‘.–jtoc-is-active’).getBoundingClientRect().top – TOCel.offsetHeight/2 – 80
TOCel.scrollBy(0,pos)
});