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