Skip to main content
variable scrollToTop
import { scrollToTop } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Smooth-scrolls to the top of the page.

Get distance from top using document.documentElement.scrollTop or document.body.scrollTop. Scroll by a fraction of the distance from the top. Use window.requestAnimationFrame() to animate the scrolling.

type

() => unknown