create template packages
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m17s
All checks were successful
Deploy / Deploy to Production (push) Successful in 5m17s
This commit is contained in:
parent
f73b8cb90b
commit
aba8b4f37e
20 changed files with 414 additions and 526 deletions
|
|
@ -1,16 +1,3 @@
|
|||
export function initSliderBeforeAfter(container = document){
|
||||
const slidersBeforeAfter = container.querySelectorAll('.slider-before-after');
|
||||
slidersBeforeAfter.forEach(function (sliderContainer, index) {
|
||||
const sliderInput = sliderContainer.querySelector('.slider');
|
||||
if (sliderInput) {
|
||||
sliderInput.addEventListener('input', (e) => {
|
||||
sliderContainer.style.setProperty('--position', `${e.target.value}%`);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function navInvestigation(){
|
||||
const nav = document.getElementById('nav-investigation');
|
||||
if (!nav) return;
|
||||
|
|
@ -43,62 +30,3 @@ export function navInvestigation(){
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export function progressBar(){
|
||||
const bar = document.getElementById('progressBar');
|
||||
if (!bar) return;
|
||||
|
||||
window.addEventListener('scroll', () => {
|
||||
const scrollTop = window.scrollY;
|
||||
const docHeight = document.documentElement.scrollHeight - window.innerHeight;
|
||||
const progress = docHeight > 0 ? (scrollTop / docHeight) * 160 : 0;
|
||||
bar.style.width = `${progress}%`;
|
||||
}, { passive: true });
|
||||
}
|
||||
|
||||
|
||||
export function scrollBack(){
|
||||
const bottomBar = document.getElementById('bottom-bar');
|
||||
const navInvestigation = document.getElementById('nav-investigation');
|
||||
const header = document.getElementById('site-header');
|
||||
const footerEl = document.getElementById('support-bar') || document.getElementById('site-footer');
|
||||
|
||||
let lastY = window.scrollY;
|
||||
let peakY = window.scrollY;
|
||||
let visible = false;
|
||||
|
||||
window.addEventListener('scroll', () => {
|
||||
const currentY = window.scrollY;
|
||||
|
||||
// header : basé uniquement sur la position absolue
|
||||
if (navInvestigation && header) {
|
||||
header.classList.toggle('has-nav-investigation', currentY >= 160);
|
||||
}
|
||||
|
||||
// zone footer : bottom-bar masquée et verrouillée
|
||||
const inFooterZone = footerEl && (currentY + window.innerHeight >= footerEl.offsetTop);
|
||||
|
||||
if (inFooterZone) {
|
||||
if (visible) {
|
||||
visible = false;
|
||||
if (bottomBar) bottomBar.classList.remove('is-visible');
|
||||
}
|
||||
} else if (currentY > lastY) {
|
||||
// scroll bas
|
||||
peakY = currentY;
|
||||
if (!visible && currentY > 280) {
|
||||
visible = true;
|
||||
if (bottomBar) bottomBar.classList.add('is-visible');
|
||||
}
|
||||
} else {
|
||||
// scroll haut : hide après 200px remontés
|
||||
if (visible && peakY - currentY >= 200) {
|
||||
visible = false;
|
||||
if (bottomBar) bottomBar.classList.remove('is-visible');
|
||||
}
|
||||
}
|
||||
|
||||
lastY = currentY;
|
||||
}, { passive: true });
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue