Commit b158e124 authored by 杨奕's avatar 杨奕 Committed by baiyaaaaa

update anchor (#1829)

parent 5027e86d
...@@ -160,13 +160,13 @@ ...@@ -160,13 +160,13 @@
goAnchor() { goAnchor() {
if (location.href.match(/#/g).length > 1) { if (location.href.match(/#/g).length > 1) {
const auchor = location.href.match(/#[^#]+$/g); const anchor = location.href.match(/#[^#]+$/g);
if (!auchor || auchor.length !== 1) return; if (!anchor) return;
const elm = document.querySelector(auchor[0]); const elm = document.querySelector(anchor[0]);
if (!elm) return; if (!elm) return;
setTimeout(_ => { setTimeout(_ => {
document.documentElement.scrollTop = document.body.scrollTop = elm.offsetTop; document.documentElement.scrollTop = document.body.scrollTop = elm.offsetTop + 120;
}, 50); }, 50);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment