Merge pull request #5957 from Ocelot-Social-Community/5953-navbar-disappears-when-scrolling-to-top

fix(webapp): navbar disappears when scrolling to top
This commit is contained in:
Alexander Friedland 2023-02-09 16:04:40 +01:00 committed by GitHub
commit 982257b5f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -309,11 +309,13 @@ export default {
methods: { methods: {
handleScroll() { handleScroll() {
const currentScrollPos = window.pageYOffset const currentScrollPos = window.pageYOffset
if (this.prevScrollpos > 50) {
if (this.prevScrollpos > currentScrollPos) { if (this.prevScrollpos > currentScrollPos) {
this.hideNavbar = false this.hideNavbar = false
} else { } else {
this.hideNavbar = true this.hideNavbar = true
} }
}
this.prevScrollpos = currentScrollPos this.prevScrollpos = currentScrollPos
}, },
toggleMobileMenuView() { toggleMobileMenuView() {

View File

@ -214,6 +214,7 @@ export default {
}, },
handleScroll() { handleScroll() {
const currentScrollPos = window.pageYOffset const currentScrollPos = window.pageYOffset
if (this.prevScrollpos > 50) {
if (this.prevScrollpos > currentScrollPos) { if (this.prevScrollpos > currentScrollPos) {
this.hideByScroll = false this.hideByScroll = false
} else { } else {
@ -221,6 +222,7 @@ export default {
this.hideByScroll = true this.hideByScroll = true
} }
} }
}
this.prevScrollpos = currentScrollPos this.prevScrollpos = currentScrollPos
}, },
beforeDestroy() { beforeDestroy() {