aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+about/about-peertube/about-peertube.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-16 09:56:24 +0200
committerChocobozzz <me@florianbigard.com>2020-06-16 11:26:46 +0200
commit64e0f8cf12c804a7a2fa582fd954f686cea9a45b (patch)
treee76dd7980665c1ac814ed4acd4fe9ce3a3e11974 /client/src/app/+about/about-peertube/about-peertube.component.ts
parentc7763eddd14ee6a4a448d5187f46f79b22047d20 (diff)
downloadPeerTube-64e0f8cf12c804a7a2fa582fd954f686cea9a45b.tar.gz
PeerTube-64e0f8cf12c804a7a2fa582fd954f686cea9a45b.tar.zst
PeerTube-64e0f8cf12c804a7a2fa582fd954f686cea9a45b.zip
Fix scrolling with hash in url
Diffstat (limited to 'client/src/app/+about/about-peertube/about-peertube.component.ts')
-rw-r--r--client/src/app/+about/about-peertube/about-peertube.component.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/client/src/app/+about/about-peertube/about-peertube.component.ts b/client/src/app/+about/about-peertube/about-peertube.component.ts
index 98c5f93c3..b175a41bc 100644
--- a/client/src/app/+about/about-peertube/about-peertube.component.ts
+++ b/client/src/app/+about/about-peertube/about-peertube.component.ts
@@ -8,11 +8,17 @@ import { ViewportScroller } from '@angular/common'
8}) 8})
9 9
10export class AboutPeertubeComponent implements AfterViewChecked { 10export class AboutPeertubeComponent implements AfterViewChecked {
11 private lastScrollHash: string
12
11 constructor ( 13 constructor (
12 private viewportScroller: ViewportScroller 14 private viewportScroller: ViewportScroller
13 ) {} 15 ) {}
14 16
15 ngAfterViewChecked () { 17 ngAfterViewChecked () {
16 if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) 18 if (window.location.hash && window.location.hash !== this.lastScrollHash) {
19 this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))
20
21 this.lastScrollHash = window.location.hash
22 }
17 } 23 }
18} 24}