mirror of
https://git.topisto.net/tibo/template.git
synced 2026-03-31 19:29:10 +00:00
Compare commits
2 Commits
production
...
72c551a82d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72c551a82d | ||
|
|
525939e44b |
204
frontend/protos/back/index.html
Normal file
204
frontend/protos/back/index.html
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>template ZONES</title>
|
||||||
|
|
||||||
|
<meta name="description" content="PROTO">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta charset="utf-8">
|
||||||
|
|
||||||
|
<link rel="preload" as="font" type="../font/woff2" href="fonts/Fonte-Texte.woff2" crossorigin />
|
||||||
|
<link rel="preload" as="font" type="../font/woff2" href="fonts/Fonte-Titre.woff2" crossorigin />
|
||||||
|
<link rel="stylesheet" type="text/css" href="zones.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<section id="header">HEADER</section>
|
||||||
|
|
||||||
|
<section id="navbar">NAVBAR</section>
|
||||||
|
|
||||||
|
<section id="synthese">SYNTHESE</section>
|
||||||
|
|
||||||
|
<section id="principale">PRINCIPALE</section>
|
||||||
|
|
||||||
|
<section id="footer">FOOTER</section>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<template id="zone">
|
||||||
|
<div id="div_before_zone"></div>
|
||||||
|
<div id="div_zone">zone</div>
|
||||||
|
<div id="div_after_zone"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="zones.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function addClassToElement(id,className){
|
||||||
|
const element=document.querySelector(id);
|
||||||
|
if (element) element.classList.add(className);
|
||||||
|
}
|
||||||
|
function removeClassToElement(id,className){
|
||||||
|
const element=document.querySelector(id);
|
||||||
|
if (element) element.classList.remove(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initZoneElements(zone) {
|
||||||
|
const element=document.querySelector('#div_'+zone);
|
||||||
|
if (element) {
|
||||||
|
element.innerHTML=zone;
|
||||||
|
addClassToElement('#div_before_'+zone,'div_before_section');
|
||||||
|
addClassToElement('#div_'+zone,'div_section');
|
||||||
|
addClassToElement('#div_after_'+zone,'div_after_section');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initZone(zone) {
|
||||||
|
const sectionZone = document.querySelector('#'+zone);
|
||||||
|
if (sectionZone) {
|
||||||
|
const template = document.querySelector('#zone');
|
||||||
|
if (template) {
|
||||||
|
const contenu = document.importNode(template.content, true);
|
||||||
|
if (contenu) {
|
||||||
|
sectionZone.innerHTML='';
|
||||||
|
contenu.childNodes.forEach((element) => {if (element.id) element.id=element.id.replace('zone',zone)});
|
||||||
|
sectionZone.appendChild(contenu);
|
||||||
|
initZoneElements(zone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initZone('header');
|
||||||
|
initZone('navbar');
|
||||||
|
initZone('synthese');
|
||||||
|
initZone('principale');
|
||||||
|
initZone('footer');
|
||||||
|
|
||||||
|
addClassToElement('#div_header','header');
|
||||||
|
addClassToElement('#div_navbar','navbar');
|
||||||
|
addClassToElement('#div_synthese','synthese');
|
||||||
|
addClassToElement('#div_principale','principale');
|
||||||
|
addClassToElement('#div_footer','footer');
|
||||||
|
|
||||||
|
const section_navbar=document.querySelector('#div_navbar');
|
||||||
|
const section_synthese=document.querySelector('#div_synthese');
|
||||||
|
const after_section_synthese=document.querySelector('#div_after_synthese');
|
||||||
|
|
||||||
|
function scrollToElement(elementSelector) {
|
||||||
|
const element = document.querySelector(elementSelector);
|
||||||
|
if (element) {
|
||||||
|
element.scrollIntoView();
|
||||||
|
logMsg('HtmlElement','scrollTo '+elementSelector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function etatSections(etat) {
|
||||||
|
switch (etat) {
|
||||||
|
case 1 :
|
||||||
|
scrollToElement('#div_before_header');
|
||||||
|
section_synthese.style.display = "block";
|
||||||
|
removeClassToElement('#div_navbar','navbar_fixed');
|
||||||
|
removeClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed');
|
||||||
|
break;
|
||||||
|
case 2 :
|
||||||
|
scrollToElement('#div_before_navbar');
|
||||||
|
section_synthese.style.display = "block";
|
||||||
|
addClassToElement('#div_navbar','navbar_fixed');
|
||||||
|
addClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed');
|
||||||
|
break;
|
||||||
|
case 3 :
|
||||||
|
scrollToElement('#div_before_navbar');
|
||||||
|
section_synthese.style.display = "none";
|
||||||
|
addClassToElement('#div_navbar','navbar_fixed');
|
||||||
|
addClassToElement('#div_before_synthese','div_before_synthese_when_navbar_fixed');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
after_section_synthese.addEventListener("click", function() {
|
||||||
|
if (section_synthese.style.display === "block") {
|
||||||
|
etatSections(3);
|
||||||
|
} else {
|
||||||
|
etatSections(2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function beforeHeaderVisibility(_visible) {
|
||||||
|
intersectionObserverLog('TRIGGER '+arguments.callee.name);
|
||||||
|
if (!_visible) {
|
||||||
|
etatSections(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function afterHeaderVisibility(_visible) {
|
||||||
|
intersectionObserverLog('TRIGGER '+arguments.callee.name);
|
||||||
|
if (_visible) {
|
||||||
|
etatSections(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addIntersectionObserverEntry("div_before_header", beforeHeaderVisibility);
|
||||||
|
addIntersectionObserverEntry("div_after_header", afterHeaderVisibility);
|
||||||
|
|
||||||
|
function beforeNavbarVisibility(_visible) {
|
||||||
|
intersectionObserverLog('TRIGGER '+arguments.callee.name);
|
||||||
|
if (!_visible) {
|
||||||
|
etatSections(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function afterNavbarVisibility(_visible) {
|
||||||
|
intersectionObserverLog('TRIGGER '+arguments.callee.name);
|
||||||
|
if (_visible) {
|
||||||
|
etatSections(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addIntersectionObserverEntry("div_before_navbar", beforeNavbarVisibility);
|
||||||
|
//addIntersectionObserverEntry("div_after_navbar", afterNavbarVisibility);
|
||||||
|
|
||||||
|
let yprev = window.pageYOffset;
|
||||||
|
const scrollHandler = () => {
|
||||||
|
const y = window.pageYOffset;
|
||||||
|
const ymax = document.documentElement.scrollHeight - window.innerHeight;
|
||||||
|
|
||||||
|
if (y > yprev) {
|
||||||
|
if (section_header.style.display !== "none") {
|
||||||
|
section_header.style.display="none";
|
||||||
|
} else {
|
||||||
|
if (section_synthese.style.display !== "none") {
|
||||||
|
section_synthese.style.display="none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (y < yprev) {
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
|
||||||
|
const throttleCallback = (callback, timeout) => {
|
||||||
|
let wait = false;
|
||||||
|
return () => {
|
||||||
|
if (wait) return;
|
||||||
|
callback.call();
|
||||||
|
wait = true;
|
||||||
|
setTimeout(() => { wait = false; }, timeout);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// window.addEventListener('scroll', throttleCallback(scrollHandler, 250));
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
112
frontend/protos/back/zones.css
Normal file
112
frontend/protos/back/zones.css
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
:root {
|
||||||
|
|
||||||
|
--dark-mode: 1;
|
||||||
|
|
||||||
|
--r-sombre: 0;
|
||||||
|
--g-sombre: 0;
|
||||||
|
--b-sombre: 0;
|
||||||
|
|
||||||
|
--r-clair: 245;
|
||||||
|
--g-clair: 245;
|
||||||
|
--b-clair: 240;
|
||||||
|
|
||||||
|
--rgb-sombre: var(--r-sombre), var(--g-sombre), var(--b-sombre);
|
||||||
|
--rgb-clair: var(--r-clair), var(--g-clair), var(--b-clair);
|
||||||
|
|
||||||
|
--couleur-sombre: rgb(var(--rgb-sombre));
|
||||||
|
--couleur-clair: rgb(var(--rgb-clair));
|
||||||
|
|
||||||
|
--couleur-texte: black;
|
||||||
|
--couleur-fond: var(--couleur-clair);
|
||||||
|
|
||||||
|
--marker-before-height: 5px;
|
||||||
|
--marker-after-height: 12px;
|
||||||
|
--section-min-height: 80px;
|
||||||
|
|
||||||
|
--section-header-min-height: 120px;
|
||||||
|
--section-synthese-min-height: 120px;
|
||||||
|
--section-principale-min-height: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Fonte-Texte';
|
||||||
|
font-display: fallback;
|
||||||
|
/* Penser à bien héberger la font sur le même domaine que mon site */
|
||||||
|
src: url(../fonts/Fonte-Texte.woff2) format('woff2');
|
||||||
|
/* Réutiliser ici exactement la même liste unicode que ci-dessus */
|
||||||
|
unicode-range: U+20-5F, U+61-7A, U+7C, U+A0, U+A7, U+A9, U+AB, U+B2-B3, U+BB, U+C0, U+C2, U+C6-CB,
|
||||||
|
U+CE-CF, U+D4, U+D9, U+DB-DC, U+E0, U+E2, U+E6-EB, U+EE-EF, U+F4, U+F9, U+FB-FC, U+FF,
|
||||||
|
U+152-153, U+178, U+2B3, U+2E2, U+1D48-1D49, U+2010-2011, U+2013-2014, U+2019, U+201C-201D,
|
||||||
|
U+2020-2021, U+2026, U+202F-2030, U+20AC, U+2212;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Fonte-Titre';
|
||||||
|
font-display: fallback;
|
||||||
|
/* Penser à bien héberger la font sur le même domaine que mon site */
|
||||||
|
src: url(../fonts/Fonte-Titre.woff2) format('woff2');
|
||||||
|
/* Réutiliser ici exactement la même liste unicode que ci-dessus */
|
||||||
|
unicode-range: U+20-5F, U+61-7A, U+7C, U+A0, U+A7, U+A9, U+AB, U+B2-B3, U+BB, U+C0, U+C2, U+C6-CB,
|
||||||
|
U+CE-CF, U+D4, U+D9, U+DB-DC, U+E0, U+E2, U+E6-EB, U+EE-EF, U+F4, U+F9, U+FB-FC, U+FF,
|
||||||
|
U+152-153, U+178, U+2B3, U+2E2, U+1D48-1D49, U+2010-2011, U+2013-2014, U+2019, U+201C-201D,
|
||||||
|
U+2020-2021, U+2026, U+202F-2030, U+20AC, U+2212;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: Fonte-Texte, monospace;
|
||||||
|
width: 95%;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: var(--couleur-fond);
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
min-height:1000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.div_before_section {
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
background-color: black;
|
||||||
|
height: var(--marker-before-height);
|
||||||
|
}
|
||||||
|
.div_section {
|
||||||
|
min-height: var(--section-min-height);
|
||||||
|
}
|
||||||
|
.div_after_section {
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
background-color: red;
|
||||||
|
height: var(--marker-after-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
min-height: var(--section-header-min-height);
|
||||||
|
background-color: aqua;
|
||||||
|
}
|
||||||
|
.navbar {
|
||||||
|
background-color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar_fixed {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
.div_before_synthese_when_navbar_fixed {
|
||||||
|
height: var(--section-min-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.synthese {
|
||||||
|
background-color: pink;
|
||||||
|
min-height: var(--section-synthese-min-height);
|
||||||
|
}
|
||||||
|
.principale {
|
||||||
|
min-height: var(--section-principale-min-height);
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
background-color: greenyellow;
|
||||||
|
}
|
||||||
|
|
||||||
56
frontend/protos/back/zones.js
Normal file
56
frontend/protos/back/zones.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
function logMsg(section, message){
|
||||||
|
console.log(section, ' : ', message)
|
||||||
|
}
|
||||||
|
|
||||||
|
function intersectionObserverLog(message) {
|
||||||
|
logMsg('intersectionObserver', message);
|
||||||
|
}
|
||||||
|
function intersectionObserverLogVisibility(_id, _visible) {
|
||||||
|
if (_visible) {
|
||||||
|
intersectionObserverLog(_id + ' is Visible');
|
||||||
|
} else {
|
||||||
|
intersectionObserverLog(_id + ' is NOT Visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const intersectionObserverRegistry = new Object();
|
||||||
|
function setIntersectionObserverRegistry(parametre, valeur)
|
||||||
|
{
|
||||||
|
intersectionObserverRegistry[parametre] = valeur;
|
||||||
|
}
|
||||||
|
function getIntersectionObserverRegistry(parametre)
|
||||||
|
{
|
||||||
|
return intersectionObserverRegistry[parametre];
|
||||||
|
}
|
||||||
|
function entryVisiblity(_id, _visible) {
|
||||||
|
let entry=getIntersectionObserverRegistry(_id);
|
||||||
|
if (entry) return entry(_visible);
|
||||||
|
return intersectionObserverLogVisibility(_id, _visible)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a function that will handle any intersection between some elements and the viewport.
|
||||||
|
const handleIntersectionObserverEntries = function (entries) {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
intersectionObserverLog(entry.target.id+' ratio '+entry.intersectionRatio);
|
||||||
|
if (typeof entryVisiblity === 'function') entryVisiblity(entry.target.id, entry.isIntersecting);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const intersectionObserver = new IntersectionObserver(handleIntersectionObserverEntries,{
|
||||||
|
// Dès qu'il y a ne serait-ce qu'un pixel au dessus de la ligne rouge
|
||||||
|
// => donc threshold = 1
|
||||||
|
threshold: 0,
|
||||||
|
// 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
|
||||||
|
// était positif, alors la ligne rouge se retrouverait sous l'image
|
||||||
|
rootMargin: '-1px 0px'
|
||||||
|
});
|
||||||
|
|
||||||
|
function addIntersectionObserverEntry(_id, _func)
|
||||||
|
{
|
||||||
|
let item = document.querySelector('#'+_id);
|
||||||
|
if ((item) && (intersectionObserver)) {
|
||||||
|
setIntersectionObserverRegistry(_id, _func);
|
||||||
|
intersectionObserver.observe(item);
|
||||||
|
logMsg('intersectionObserver', 'Add entry for '+ _id);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
frontend/protos/index.html
Normal file
29
frontend/protos/index.html
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>template ZONES</title>
|
||||||
|
|
||||||
|
<meta name="description" content="PROTO">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta charset="utf-8">
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" href="styles.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header></header>
|
||||||
|
|
||||||
|
<nav></nav>
|
||||||
|
|
||||||
|
<section id="synthese"></section>
|
||||||
|
|
||||||
|
<section id="principale"></section>
|
||||||
|
|
||||||
|
<footer></footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
76
frontend/protos/styles.css
Normal file
76
frontend/protos/styles.css
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
:root {
|
||||||
|
|
||||||
|
--dark-mode: 1;
|
||||||
|
|
||||||
|
--r-sombre: 0;
|
||||||
|
--g-sombre: 0;
|
||||||
|
--b-sombre: 0;
|
||||||
|
|
||||||
|
--r-clair: 245;
|
||||||
|
--g-clair: 245;
|
||||||
|
--b-clair: 240;
|
||||||
|
|
||||||
|
--rgb-sombre: var(--r-sombre), var(--g-sombre), var(--b-sombre);
|
||||||
|
--rgb-clair: var(--r-clair), var(--g-clair), var(--b-clair);
|
||||||
|
|
||||||
|
--couleur-sombre: rgb(var(--rgb-sombre));
|
||||||
|
--couleur-clair: rgb(var(--rgb-clair));
|
||||||
|
|
||||||
|
--couleur-texte: black;
|
||||||
|
--couleur-fond: var(--couleur-clair);
|
||||||
|
|
||||||
|
--header-height: 400px;
|
||||||
|
--nav-height: 80px;
|
||||||
|
--synthese-min-height: 150px;
|
||||||
|
--principale-min-height: 1000px;
|
||||||
|
--footer-min-height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: monospace;
|
||||||
|
max-width: 95%;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: var(--couleur-fond);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
min-height:1000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
background-color: aqua;
|
||||||
|
height: var(--header-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
position: sticky;
|
||||||
|
top: 0px;
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
background-color: yellow;
|
||||||
|
height: var(--nav-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
#synthese {
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
background-color: rgb(252, 130, 201);
|
||||||
|
min-height: var(--synthese-min-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
#principale {
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
background-color: rgb(63, 15, 177);
|
||||||
|
min-height: var(--principale-min-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
position: sticky;
|
||||||
|
bottom: 0px;
|
||||||
|
color: var(--couleur-texte);
|
||||||
|
background-color: rgb(9, 138, 15);
|
||||||
|
min-height: var(--footer-min-height);
|
||||||
|
}
|
||||||
81
frontend/protos/zones.js
Normal file
81
frontend/protos/zones.js
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
const intersectionObserverRegistry = new Object();
|
||||||
|
function setIntersectionObserverRegistry(parametre, valeur)
|
||||||
|
{
|
||||||
|
intersectionObserverRegistry[parametre] = valeur;
|
||||||
|
}
|
||||||
|
function getIntersectionObserverRegistry(parametre)
|
||||||
|
{
|
||||||
|
return intersectionObserverRegistry[parametre];
|
||||||
|
}
|
||||||
|
function entryVisiblity(_id, _visible) {
|
||||||
|
let entry=getIntersectionObserverRegistry(_id);
|
||||||
|
if (entry) return entry(_visible);
|
||||||
|
return consoleLog(_id, _visible)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a function that will handle any intersection between some elements and the viewport.
|
||||||
|
const handleIntersectionObserverEntries = function (entries) {
|
||||||
|
entries.forEach(entry => {
|
||||||
|
if (typeof entryVisiblity === 'function') entryVisiblity(entry.target.id, entry.isIntersecting);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const intersectionObserver = new IntersectionObserver(handleIntersectionObserverEntries);
|
||||||
|
|
||||||
|
function addIntersectionObserverEntry(_id, _func)
|
||||||
|
{
|
||||||
|
let item = document.querySelector('#'+_id);
|
||||||
|
if ((item) && (intersectionObserver)) {
|
||||||
|
setIntersectionObserverRegistry(_id, _func);
|
||||||
|
intersectionObserver.observe(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function consoleLog(_id, _visible) {
|
||||||
|
if (_visible) {
|
||||||
|
console.log(_id + ' is Visible');
|
||||||
|
} else {
|
||||||
|
console.log(_id + ' is NOT Visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scrollToElement(elementSelector) {
|
||||||
|
let element = document.querySelector(elementSelector);
|
||||||
|
if (element) element.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeHeaderVisibility(_visible) {
|
||||||
|
console.log('TRIGGER beforeHeaderVisibility');
|
||||||
|
if (_visible) {
|
||||||
|
console.log('HEADER is Visible');
|
||||||
|
} else {
|
||||||
|
console.log('HEADER is NOT Visible');
|
||||||
|
scrollToElement('#before_nav');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function afterHeaderVisibility(_visible) {
|
||||||
|
console.log('TRIGGER afterHeaderVisibility');
|
||||||
|
if (_visible) {
|
||||||
|
scrollToElement('#before_header');
|
||||||
|
} else {
|
||||||
|
console.log('HEADER is NOT Visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeNavVisibility(_visible) {
|
||||||
|
console.log('TRIGGER beforeNavVisibility');
|
||||||
|
let synthese=document.querySelector('#synthese');
|
||||||
|
if (synthese) {
|
||||||
|
if (_visible) {
|
||||||
|
synthese.style.display="block";
|
||||||
|
} else {
|
||||||
|
synthese.style.display="none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
addIntersectionObserverEntry("before_header", beforeHeaderVisibility);
|
||||||
|
addIntersectionObserverEntry("after_header", afterHeaderVisibility);
|
||||||
|
|
||||||
|
addIntersectionObserverEntry("before_nav", beforeNavVisibility);
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user