@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
15 lines (12 loc) • 336 B
JavaScript
import { isServer } from './chunk-ZVWX56RU.mjs';
// src/scrollToTop/index.ts
function scrollToTop() {
if (isServer())
return;
const c = document.documentElement.scrollTop || document.body.scrollTop;
if (c > 0) {
window.requestAnimationFrame(scrollToTop);
window.scrollTo(0, c - c / 8);
}
}
export { scrollToTop };