refactoring and renaming intersection observer for chapters

This commit is contained in:
Antoine M 2023-10-12 12:04:38 +02:00
parent 7b8f5b8751
commit aebf62a903

View File

@ -30,8 +30,8 @@ export default function singleConseil() {
});
});
// Register IntersectionObserver
const io = new IntersectionObserver(
// CHAPTER IntersectionObserver
const chapterProgressionObserver = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
@ -66,8 +66,7 @@ export default function singleConseil() {
allBlocks = buildAllBlocksToObserve();
allBlocks.forEach((el) => {
console.log(el);
io.observe(el);
allBlocks.forEach((block) => {
chapterProgressionObserver.observe(block);
});
}