mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
fix(nuxt): handle scroll-padding-top: auto
in scrollBehavior (#28320)
This commit is contained in:
parent
0223761847
commit
acea730a6b
@ -58,7 +58,7 @@ function _getHashElementScrollMarginTop (selector: string): number {
|
||||
try {
|
||||
const elem = document.querySelector(selector)
|
||||
if (elem) {
|
||||
return Number.parseFloat(getComputedStyle(elem).scrollMarginTop) + Number.parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop)
|
||||
return (Number.parseFloat(getComputedStyle(elem).scrollMarginTop) || 0) + (Number.parseFloat(getComputedStyle(document.documentElement).scrollPaddingTop) || 0)
|
||||
}
|
||||
} catch {
|
||||
// ignore any errors parsing scrollMarginTop
|
||||
|
Loading…
Reference in New Issue
Block a user