From 8182d92b8db530b6415604d5f7bcab21e1f6808a Mon Sep 17 00:00:00 2001 From: Oleksii Aleksandrov Date: Thu, 1 Mar 2018 16:51:24 +0200 Subject: [PATCH] fix(demo): fix add-nav scroll to selected sections (#3593) --- demo/src/app/common/add-nav/add-nav.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/src/app/common/add-nav/add-nav.component.ts b/demo/src/app/common/add-nav/add-nav.component.ts index 25d90849d2..268b528e5b 100644 --- a/demo/src/app/common/add-nav/add-nav.component.ts +++ b/demo/src/app/common/add-nav/add-nav.component.ts @@ -19,8 +19,8 @@ export class AddNavComponent { const anchor: string = item.dataset.anchor; const target: HTMLElement = this.document.getElementById(anchor); const header: HTMLElement = this.document.getElementById('header'); - const headerIndent: number = header.offsetHeight + 6; - this.document.body.scrollTop = target.offsetTop - headerIndent; + const targetPosY: number = target.offsetTop - header.offsetHeight - 6; + window.scrollTo(0, targetPosY); } } }