refactor(app.js, glossary): make smoothscroll work with links in md
This commit is contained in:
parent
18bb4da76c
commit
eb618cc874
1 changed files with 1 additions and 6 deletions
7
app/dist/scripts/app.js
vendored
7
app/dist/scripts/app.js
vendored
|
@ -36,13 +36,8 @@ document.querySelectorAll("a[href^='#']").forEach(anchor => {
|
|||
if (document.getElementById(element)) {
|
||||
elementOffset = document.getElementById(element).offsetTop - 74;
|
||||
window.scroll({ top: elementOffset, behavior: "smooth" });
|
||||
history.replaceState({}, "", `#${element}`); // Add hash to URL bar
|
||||
}
|
||||
|
||||
// Add hash to URL bar when sidebar links are clicked
|
||||
if (
|
||||
event.target.parentElement.className === "api__toc__item" ||
|
||||
event.target.parentElement.parentElement.className === "component--glossary-toc"
|
||||
) history.replaceState({}, "", `#${element}`);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue