Skip to content

Files

Latest commit

6ef2c3d · Apr 4, 2021

History

History
28 lines (21 loc) · 513 Bytes

useScrolling.md

File metadata and controls

28 lines (21 loc) · 513 Bytes

useScrolling

Vue sensor hook that keeps track of whether the user is scrolling or not.

Usage

import { useScrolling, useRef } from "vue-next-use";

const Demo = {
  setup(){
      const scrollRef = useRef(null);
      const scrolling = useScrolling(scrollRef);

      return () => (
          <div ref={scrollRef}>
              {<div>{scrolling.value ? "Scrolling" : "Not scrolling"}</div>}
          </div>
      );
  }
};

Reference

useScrolling(ref: RefObject<HTMLElement>);