Răsfoiți Sursa

81439 smooth-scroll var name

Mao 4 ani în urmă
părinte
comite
ad6d03a2dc
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      packages/app/src/client/util/smooth-scroll.ts

+ 2 - 2
packages/app/src/client/util/smooth-scroll.ts

@@ -1,6 +1,6 @@
 const WIKI_HEADER_LINK = 120;
 
-export const smoothScrollIntoView = (element: HTMLElement, offsetTop = 0, startFrom : HTMLElement | Window = window): void => {
+export const smoothScrollIntoView = (element: HTMLElement, offsetTop = 0, scrollElement: HTMLElement | Window = window): void => {
   const targetElement = element || window.document.body;
 
   // get the distance to the target element top
@@ -8,7 +8,7 @@ export const smoothScrollIntoView = (element: HTMLElement, offsetTop = 0, startF
 
   const top = window.pageYOffset + rectTop - offsetTop;
 
-  startFrom.scrollTo({
+  scrollElement.scrollTo({
     top,
     behavior: 'smooth',
   });