1
0
mirror of https://git.topisto.net/tibo/template.git synced 2026-03-31 17:19:10 +00:00

[evo4532] 202601021003

This commit is contained in:
Thibaud
2026-01-02 10:03:49 +01:00
parent 0dbccd74de
commit ef705874b1
2 changed files with 16 additions and 27 deletions

View File

@@ -122,22 +122,22 @@
etatSectionLog('Etat courant '+currentEtatSection); etatSectionLog('Etat courant '+currentEtatSection);
switch (currentEtatSection) { switch (currentEtatSection) {
case 1 : case 1 :
scrollToElement('#div_before_header');
section_header.style.display = "block";
removeClassToElement('#div_navbar','navbar_fixed'); removeClassToElement('#div_navbar','navbar_fixed');
removeClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed'); removeClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed');
section_header.style.display = "block";
scrollToElement('#div_before_header');
break; break;
case 2 : case 2 :
addClassToElement('#div_navbar','navbar_fixed');
addClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed');
scrollToElement('#div_before_navbar'); scrollToElement('#div_before_navbar');
section_synthese.style.display = "block"; section_synthese.style.display = "block";
addClassToElement('#div_navbar','navbar_fixed');
addClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed');
break; break;
case 3 : case 3 :
scrollToElement('#div_before_navbar');
section_synthese.style.display = "none";
addClassToElement('#div_navbar','navbar_fixed'); addClassToElement('#div_navbar','navbar_fixed');
addClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed'); addClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed');
section_synthese.style.display = "none";
scrollToElement('#div_before_navbar');
break; break;
default : default :
break; break;
@@ -170,7 +170,7 @@
} }
function beforeSection(_visible) { function beforeSection(_visible) {
if (!_visible) changeSectionEtatUp(); if (!_visible) changeEtatSectionUp();
} }
function afterSection(_visible) { function afterSection(_visible) {
if (_visible) changeEtatSectionDown(); if (_visible) changeEtatSectionDown();
@@ -195,37 +195,25 @@
addIntersectionObserverEntry("div_before_header", beforeHeaderVisibility); addIntersectionObserverEntry("div_before_header", beforeHeaderVisibility);
addIntersectionObserverEntry("div_after_header", afterHeaderVisibility); addIntersectionObserverEntry("div_after_header", afterHeaderVisibility);
addIntersectionObserverEntry("div_before_navbar", beforeNavbarVisibility); addIntersectionObserverEntry("div_before_navbar", beforeNavbarVisibility);
//addIntersectionObserverEntry("div_after_navbar", afterNavbarVisibility); addIntersectionObserverEntry("div_after_navbar", afterNavbarVisibility);
/*
let yprev = window.pageYOffset; let yprev = window.pageYOffset;
const scrollHandler = () => { const scrollHandler = () => {
const y = window.pageYOffset; const y = window.pageYOffset;
const ymax = document.documentElement.scrollHeight - window.innerHeight; const ymax = document.documentElement.scrollHeight - window.innerHeight;
if (y > yprev) { if (y > yprev) {
if (section_header.style.display !== "none") { changeEtatSectionUp();
section_header.style.display="none";
} else {
if (section_synthese.style.display !== "none") {
section_synthese.style.display="none";
}
}
} else { } else {
if (y < yprev) { changeEtatSectionDown();
if (section_synthese.style.display !== "block") {
section_synthese.style.display="block";
} else {
if (section_header.style.display !== "block") {
section_header.style.display="block";
}
}
} }
}
yprev = Math.min(Math.max(y, 0), ymax); yprev = Math.min(Math.max(y, 0), ymax);
}; };
// window.addEventListener('scroll', throttleCallback(scrollHandler, 250)); window.addEventListener('scroll', scrollThrottleCallback(scrollHandler, 1000));
*/
</script> </script>

View File

@@ -39,7 +39,8 @@ const intersectionObserver = new IntersectionObserver(handleIntersectionObserver
// On met la hauteur en pixel entre la fin de l'image et la ligne rouge // On met la hauteur en pixel entre la fin de l'image et la ligne rouge
// C'est négatif parce qu'on entre à l'intérieur de l'image. Si le nombre // C'est négatif parce qu'on entre à l'intérieur de l'image. Si le nombre
// était positif, alors la ligne rouge se retrouverait sous l'image // était positif, alors la ligne rouge se retrouverait sous l'image
rootMargin: '-1px 0px' rootMargin: '-1px 0px'
//rootMargin: '2px 0px'
}); });
function addIntersectionObserverEntry(_id, _func) function addIntersectionObserverEntry(_id, _func)