diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-08-24 14:34:43 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-08-25 20:30:43 +0200 |
commit | fe3374d843ed0dcd756c798db128dbfbb8ad0f58 (patch) | |
tree | 7ccb83889577072ff60c83a8ea00dbf72b4a5e0e /apps/dashboard | |
parent | d4502823f4a8716c291af877e35c7350d02ca5e8 (diff) | |
download | nextcloud-server-fe3374d843ed0dcd756c798db128dbfbb8ad0f58.tar.gz nextcloud-server-fe3374d843ed0dcd756c798db128dbfbb8ad0f58.zip |
Add body class when dashboard is scrolled
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/dashboard')
-rw-r--r-- | apps/dashboard/src/App.vue | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/dashboard/src/App.vue b/apps/dashboard/src/App.vue index 7c4e51d70c7..e7668468a50 100644 --- a/apps/dashboard/src/App.vue +++ b/apps/dashboard/src/App.vue @@ -235,6 +235,7 @@ export default { }, mounted() { this.updateGlobalStyles() + window.addEventListener('scroll', this.handleScroll) setInterval(() => { this.timer = new Date() @@ -244,6 +245,9 @@ export default { window.addEventListener('scroll', this.disableFirstrunHint) } }, + destroyed() { + window.removeEventListener('scroll', this.handleScroll) + }, methods: { /** * Method to register panels that will be called by the integrating apps @@ -361,6 +365,13 @@ export default { } this.saveStatuses() }, + handleScroll() { + if (window.scrollY > 50) { + document.body.classList.add('dashboard--scrolled') + } else { + document.body.classList.remove('dashboard--scrolled') + } + }, }, } </script> |