werkbank
    Preparing search index...

    Function useScrollPosition

    • Tracks scroll position and deltas.

      Parameters

      • fn: (s: ScrollState) => void

        The callback to execute on scroll.

      • Optionaloptions: Options

        Configuration options (container, timeout).

      Returns void

      This hook listens to scroll events on the window or a specified container. It debounces the callback to improve performance.

      useScrollPosition(({ y, delta }) => {
      console.log("Scrolled to", y, "Delta", delta.y);
      }, { timeout: 100 });