X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fhelpers%2Futils.ts;h=a22507f46a3e914c4711cf99d79681607e18561b;hb=f3081d6401b63da41b03376f9f952bf1cca8303d;hp=d9007dd77490d53079cba4587f43bd613f8c5bbe;hpb=901c36d5f44e02436da5f5c2899666329ff2eb5b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/helpers/utils.ts b/client/src/app/helpers/utils.ts index d9007dd77..a22507f46 100644 --- a/client/src/app/helpers/utils.ts +++ b/client/src/app/helpers/utils.ts @@ -144,8 +144,12 @@ function sortBy (obj: any[], key1: string, key2?: string) { }) } -function scrollToTop () { - window.scroll(0, 0) +function scrollToTop (behavior: 'auto' | 'smooth' = 'auto') { + window.scrollTo({ + left: 0, + top: 0, + behavior + }) } function isInViewport (el: HTMLElement) {