Track how much the page has scrolled down relative to the top of the view port.

Usage

const scrollTop : number = useScrollTop(asPercentage?:boolean);

Example

import { useScrollTop } from 'vev';

export default function () {
return (
<div>
<h1> Scroll Top (pixels): { useScrollTop() } </h1>
<h1> Scroll Top (percentage): { useScrollTop(true) } </h1>
</div>
);
}

Did this answer your question?