mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-25 12:53:09 -04:00
[web] Fix positioning of scrolling when pages don't have tabs
This commit is contained in:
parent
dd5b4dcb32
commit
294e640ac1
@ -42,6 +42,9 @@ import PageSearchLibrary from '@/pages/PageSearchLibrary.vue'
|
|||||||
import PageSearchSpotify from '@/pages/PageSearchSpotify.vue'
|
import PageSearchSpotify from '@/pages/PageSearchSpotify.vue'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
|
||||||
|
const TOP_WITH_TABS = 140
|
||||||
|
const TOP_WITHOUT_TABS = 110
|
||||||
|
|
||||||
export const router = createRouter({
|
export const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes: [
|
routes: [
|
||||||
@ -306,7 +309,8 @@ export const router = createRouter({
|
|||||||
if (to.path === from.path && to.hash) {
|
if (to.path === from.path && to.hash) {
|
||||||
// We are staying on the same page and are jumping to an anchor (e. g. index nav)
|
// We are staying on the same page and are jumping to an anchor (e. g. index nav)
|
||||||
// We don't have a transition, so don't add a timeout!
|
// We don't have a transition, so don't add a timeout!
|
||||||
return { el: to.hash, top: 140, behavior: 'smooth' }
|
const top = to.meta.has_tabs ? TOP_WITH_TABS : TOP_WITHOUT_TABS
|
||||||
|
return { el: to.hash, top: top, behavior: 'smooth' }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to.hash) {
|
if (to.hash) {
|
||||||
@ -322,12 +326,9 @@ export const router = createRouter({
|
|||||||
// We are navigating to a page with index nav, that should be hidden automatically
|
// We are navigating to a page with index nav, that should be hidden automatically
|
||||||
// Depending on wether we have a tab navigation, add an offset to the "top" anchor
|
// Depending on wether we have a tab navigation, add an offset to the "top" anchor
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
const top = to.meta.has_tabs ? TOP_WITH_TABS : TOP_WITHOUT_TABS
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (to.meta.has_tabs) {
|
resolve({ el: '#top', top: top })
|
||||||
resolve({ el: '#top', top: 140 })
|
|
||||||
} else {
|
|
||||||
resolve({ el: '#top', top: 110 })
|
|
||||||
}
|
|
||||||
}, wait_ms)
|
}, wait_ms)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user