mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 17:07:22 +00:00
fix(nuxt): consider doc scroll-padding-top
in scrollBehavior (#28083)
This commit is contained in:
parent
2bf9fc677c
commit
e0141fea22
@ -58,7 +58,7 @@ function _getHashElementScrollMarginTop (selector: string): number {
|
|||||||
try {
|
try {
|
||||||
const elem = document.querySelector(selector)
|
const elem = document.querySelector(selector)
|
||||||
if (elem) {
|
if (elem) {
|
||||||
return Number.parseFloat(getComputedStyle(elem).scrollMarginTop)
|
return Number.parseFloat(getComputedStyle(elem).scrollMarginTop) + Number.parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop)
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// ignore any errors parsing scrollMarginTop
|
// ignore any errors parsing scrollMarginTop
|
||||||
|
Loading…
Reference in New Issue
Block a user