Interface IntersectionObserver

    provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.

    MDN Reference

    interface IntersectionObserver {
        root: Element | Document;
        rootMargin: string;
        thresholds: readonly number[];
        disconnect(): void;
        observe(target: Element): void;
        takeRecords(): IntersectionObserverEntry[];
        unobserve(target: Element): void;
    }

    Properties

    rootMargin: string
    thresholds: readonly number[]

    Methods