src/js/grid.js
/**
     * Track which cells are visible (inside the viewport)
     * by adding/removing the 'in-view' class when scrolling.
     * This will be used to animate only the ones that are visible.
     */
Track which cells are visible (inside the viewport)
by adding/removing the 'in-view' class when scrolling.
This will be used to animate only the ones that are visible.
Track which cells are visible ( inside the viewport ) by adding / removing the ' in - view ' class when scrolling . This will be used to animate only the ones that are visible .
trackVisibleCells() {
        const observer = new IntersectionObserver((entries, observer) => {
            entries.forEach(entry => {
                if (entry.intersectionRatio > 0) {
                    entry.target.classList.add('in-view');
                } 
                else {
                    entry.target.classList.remove('in-view');
                }
            });
        });
        this.DOM.imageCells.forEach(img => observer.observe(img));
    }
trackVisibleCells ( ) { const observer = new IntersectionObserver ( ( entries , observer ) => { entries . forEach ( entry => { if ( entry . intersectionRatio > 0 ) { entry . target . classList . add ( 'in-view' ) ; } else { entry . target . classList . remove ( 'in-view' ) ; } } ) ; } ) ; this . DOM . imageCells . forEach ( img => observer . observe ( img ) ) ; }
Track which cells are visible (inside the viewport)
 by adding/removing the 'in-view' class when scrolling.
Track which cells are visible ( inside the viewport ) by adding / removing the ' in - view ' class when scrolling .