aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
authorKim <1877318+kimsible@users.noreply.github.com>2020-08-10 15:57:37 +0200
committerGitHub <noreply@github.com>2020-08-10 15:57:37 +0200
commit4a53fc8204d5a3a3d5a77b3dfe128f0985153bf8 (patch)
tree249e48c8ff24b6e5f3f696a49d024a2596f7a7ea /client/src/app/app.component.ts
parent207612dff83401a9642f9cb0a63a5a6efcd5f590 (diff)
downloadPeerTube-4a53fc8204d5a3a3d5a77b3dfe128f0985153bf8.tar.gz
PeerTube-4a53fc8204d5a3a3d5a77b3dfe128f0985153bf8.tar.zst
PeerTube-4a53fc8204d5a3a3d5a77b3dfe128f0985153bf8.zip
Add new anchors in my-settings and handle offset sub-menu height (#3032)
* Add anchors setting and handle offset with sub-meu * Use PeerTube scroll logic * Add anchor for top my-settings * Improve scroller with smooth behavior and css offset * Fix anchor position when using history navigation Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index ff0e28aa5..5c64db522 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -119,12 +119,17 @@ export class AppComponent implements OnInit, AfterViewInit {
119 const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) 119 const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll))
120 120
121 scrollEvent.subscribe(e => { 121 scrollEvent.subscribe(e => {
122 if (e.position) { 122 // scrollToAnchor first to preserve anchor position when using history navigation
123 return this.viewportScroller.scrollToPosition(e.position) 123 if (e.anchor) {
124 setTimeout(() => {
125 this.viewportScroller.scrollToAnchor(e.anchor)
126 })
127
128 return
124 } 129 }
125 130
126 if (e.anchor) { 131 if (e.position) {
127 return this.viewportScroller.scrollToAnchor(e.anchor) 132 return this.viewportScroller.scrollToPosition(e.position)
128 } 133 }
129 134
130 if (resetScroll) { 135 if (resetScroll) {