diff options
author | Kim <1877318+kimsible@users.noreply.github.com> | 2020-08-17 10:13:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 10:13:31 +0200 |
commit | 30d55e75cae1adec3fc43c84691975bf8b97db34 (patch) | |
tree | 74df7fabda72d88b60d6d8d20ba9cd95d1cf4858 /client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts | |
parent | 28fbb88f93859a7f6bbf124cb8df1e1a37fd1285 (diff) | |
download | PeerTube-30d55e75cae1adec3fc43c84691975bf8b97db34.tar.gz PeerTube-30d55e75cae1adec3fc43c84691975bf8b97db34.tar.zst PeerTube-30d55e75cae1adec3fc43c84691975bf8b97db34.zip |
Add restore scroll position on user-dropdown anchors links and scroll to top on active sub-menu links (#3066)
* Add restore scroll position on router same url
* Remove settings top anchor
* Add scrollToTop on active links fixed sub-menu
* Add restore scroll position on notification avatar links
* Toggle menu and close pophover when click on active dropdown menu-left link
* Add onSameUrlRestoreScrollPosition on user dropdown channels link
* Same behavior scrollTop and scroll to anchor everywhere
Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts')
-rw-r--r-- | client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts index 043b647c9..ba5568595 100644 --- a/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts +++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts | |||
@@ -94,6 +94,16 @@ export class TopMenuDropdownComponent implements OnInit, OnDestroy { | |||
94 | this.isModalOpened = false | 94 | this.isModalOpened = false |
95 | } | 95 | } |
96 | 96 | ||
97 | onActiveLinkScrollToTop (link: HTMLAnchorElement) { | ||
98 | if (!this.isBroadcastMessageDisplayed && this.router.url.includes(link.getAttribute('href'))) { | ||
99 | window.scrollTo({ | ||
100 | left: 0, | ||
101 | top: 0, | ||
102 | behavior: 'smooth' | ||
103 | }) | ||
104 | } | ||
105 | } | ||
106 | |||
97 | dismissOtherModals () { | 107 | dismissOtherModals () { |
98 | this.modalService.dismissAll() | 108 | this.modalService.dismissAll() |
99 | } | 109 | } |