提交 4c09627d 编写于 作者: A aaron hendrick 提交者: ULIVZ

feat: allow for disabling of active hash on scroll (#489)

上级 05707775
......@@ -142,6 +142,18 @@ sidebarDepth: 2
---
```
### Active Header Links
By default, the nested header links and the hash in the URL are updated as the user scrolls to view the different sections of the page. This behavior can be disabled with the following theme config:
``` js
module.exports = {
themeConfig: {
disableActiveHash: true, // boolean
}
}
```
### Sidebar Groups
You can divide sidebar links into multiple groups by using objects:
......
......@@ -136,6 +136,10 @@ export default {
this.setActiveHash()
}, 300),
setActiveHash () {
if (this.$site.themeConfig.disableActiveHash) {
return
}
const sidebarLinks = [].slice.call(document.querySelectorAll('.sidebar-link'))
const anchors = [].slice.call(document.querySelectorAll('.header-anchor'))
.filter(anchor => sidebarLinks.some(sidebarLink => sidebarLink.hash === anchor.hash))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册