Skip to content

Commit

Permalink
fix: window scroll decimal (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
simboonlong authored Nov 12, 2022
1 parent 4bdb73e commit c6adbce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/onWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ export const onWindowScroll = ({
let scrollTopPrev = 0;

const onScroll = () => {
const scrollTopCurr =
document.body.scrollTop || document.documentElement.scrollTop;
const mostBottomTop = document.body.scrollHeight - window.innerHeight;
const scrollTopCurr = Math.round(
document.body.scrollTop || document.documentElement.scrollTop,
);
const mostBottomTop = Math.round(
document.body.scrollHeight - window.innerHeight,
);

if (between) {
between(scrollTopCurr);
Expand Down

0 comments on commit c6adbce

Please sign in to comment.