aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-10-28 23:50:03 -0400
committerbobzel <zzzman@gmail.com>2020-10-28 23:50:03 -0400
commit74e080fd58c681a549a8e369202096bd456b6e6e (patch)
treeafe45c1eeae442a64c9fa4ef6b4eb48d9ddd2900 /src/Utils.ts
parent2b580e4d8acfa1ce8ddb7a323391ccfb90885117 (diff)
fixed up webBox's to navigate better synchronously when srollTop chagnes. fixed navigation in wikipedia and other pages when hyou dont' click directly on a link.
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index cc7ee9537..daacca51d 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -475,7 +475,7 @@ const easeInOutQuad = (currentTime: number, start: number, change: number, durat
return (-change / 2) * (newCurrentTime * (newCurrentTime - 2) - 1) + start;
};
-export function smoothScroll(duration: number, element: HTMLElement, to: number) {
+export function smoothScroll(duration: number, element: HTMLElement, to: number, finish?: () => void) {
const start = element.scrollTop;
const change = to - start;
const startDate = new Date().getTime();
@@ -489,6 +489,7 @@ export function smoothScroll(duration: number, element: HTMLElement, to: number)
requestAnimationFrame(animateScroll);
} else {
element.scrollTop = to;
+ finish?.();
}
};
animateScroll();