mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 10:21:46 +01:00
fix(article): TOC link not working when the heading starts with digits (#603)
This commit is contained in:
parent
9aa6b4925b
commit
7142de24cc
1 changed files with 1 additions and 1 deletions
|
@ -23,7 +23,7 @@ function setupSmoothAnchors() {
|
|||
|
||||
let targetId = aElement.getAttribute("href").substring(1);
|
||||
// The replace done on ':' is here for footnotes, as this character would otherwise interfere when used as a CSS selector.
|
||||
let target = document.querySelector(`#${targetId.replace(":", "\\:")}`) as HTMLElement;
|
||||
let target = document.getElementById(targetId.replace(":", "\\:")) as HTMLElement;
|
||||
|
||||
window.history.pushState({}, "", aElement.getAttribute("href"));
|
||||
scrollTo({ top: target.offsetTop, behavior: "smooth" });
|
||||
|
|
Loading…
Reference in a new issue