File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -74,17 +74,19 @@ export const FrontSectionTracker = () => {
7474 const callback = ( entries : IntersectionObserverEntry [ ] ) => {
7575 for ( const entry of entries ) {
7676 if ( entry . isIntersecting ) {
77- const sectionName = entry . target . id ;
78- if ( ! viewedCollections . has ( sectionName ) ) {
79- setCollectionAsViewed ( sectionName ) ;
80- reportViewEvent ( sectionName ) ;
77+ const collectionName = entry . target . id ;
78+ if ( ! viewedCollections . has ( collectionName ) ) {
79+ setCollectionAsViewed ( collectionName ) ;
80+ reportViewEvent ( collectionName ) ;
8181 observer . unobserve ( entry . target ) ;
8282 }
8383 }
8484 }
8585 } ;
86-
87- const observer = new IntersectionObserver ( callback ) ;
86+ const options = {
87+ rootMargin : '-100px' ,
88+ } ;
89+ const observer = new IntersectionObserver ( callback , options ) ;
8890
8991 for ( const collection of collectionElements ) {
9092 observer . observe ( collection ) ;
You can’t perform that action at this time.
0 commit comments