mirror of https://github.com/nuxt/nuxt.git
fix(nuxt): consider doc `scroll-padding-top` in scrollBehavior (#28083)
This commit is contained in:
parent
53ab4ef052
commit
48a8b18083
|
@ -58,7 +58,7 @@ function _getHashElementScrollMarginTop (selector: string): number {
|
|||
try {
|
||||
const elem = document.querySelector(selector)
|
||||
if (elem) {
|
||||
return Number.parseFloat(getComputedStyle(elem).scrollMarginTop)
|
||||
return Number.parseFloat(getComputedStyle(elem).scrollMarginTop) + Number.parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop)
|
||||
}
|
||||
} catch {
|
||||
// ignore any errors parsing scrollMarginTop
|
||||
|
|
Loading…
Reference in New Issue