fix anchor navigation for safari
This commit is contained in:
@@ -13,7 +13,10 @@ export default function (Vue, options, context) {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const element = document.getElementById(to.hash.substr(1))
|
const element = document.getElementById(to.hash.substr(1))
|
||||||
const top = element.offsetTop
|
const top = element.offsetTop
|
||||||
const offset = parseFloat(getComputedStyle(element).scrollMarginTop)
|
const offset = parseFloat(
|
||||||
|
getComputedStyle(element).scrollMarginTop
|
||||||
|
|| getComputedStyle(element).scrollSnapMarginTop,
|
||||||
|
)
|
||||||
|
|
||||||
window.scrollTo(0, top - offset)
|
window.scrollTo(0, top - offset)
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ body {
|
|||||||
|
|
||||||
*[id] {
|
*[id] {
|
||||||
scroll-margin-top: 6rem;
|
scroll-margin-top: 6rem;
|
||||||
|
scroll-snap-margin-top: 6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
|||||||
Reference in New Issue
Block a user