From d2eb07506e04926ae1b8d4cf69be62318c022c72 Mon Sep 17 00:00:00 2001 From: Badr Largab Date: Mon, 26 Oct 2020 17:12:56 +0100 Subject: [PATCH] update scroll-top.component.ts Add scroll behavior to the window.scrollTo(), by default the behavior is auto, giving an extra option for smooth-scroll would be nice. --- projects/ng-boosted/src/lib/o-scroll/scroll-top.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/ng-boosted/src/lib/o-scroll/scroll-top.component.ts b/projects/ng-boosted/src/lib/o-scroll/scroll-top.component.ts index 19d44d72..c359052d 100644 --- a/projects/ng-boosted/src/lib/o-scroll/scroll-top.component.ts +++ b/projects/ng-boosted/src/lib/o-scroll/scroll-top.component.ts @@ -15,9 +15,11 @@ export class ScrollTopComponent { public showMe = false; @Input() public label: string; + + @Input() public behavior: 'auto' | 'smooth' = 'auto'; public ScrollToTop() { - window.scrollTo(0, 0); + window.scrollTo(0, 0, behavior); } @HostListener('window:scroll', []) public onWindowScroll() {