File tree 3 files changed +24
-6
lines changed
docs/docs/plugin/official
3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module.exports = (options) => ({
4
4
clientRootMixin : path . resolve ( __dirname , 'mixin.js' ) ,
5
5
define : {
6
6
AHL_SIDEBAR_LINK_SELECTOR : options . sidebarLinkSelector || '.sidebar-link' ,
7
- AHL_HEADER_ANCHOR_SELECTOR : options . headerAnchorSelector || '.header-anchor'
7
+ AHL_HEADER_ANCHOR_SELECTOR : options . headerAnchorSelector || '.header-anchor' ,
8
+ AHL_TOP_OFFSET : options . headerTopOffset || 90
8
9
}
9
10
} )
Original file line number Diff line number Diff line change 1
- /* global AHL_SIDEBAR_LINK_SELECTOR, AHL_HEADER_ANCHOR_SELECTOR */
1
+ /* global AHL_SIDEBAR_LINK_SELECTOR, AHL_HEADER_ANCHOR_SELECTOR, AHL_TOP_OFFSET */
2
2
3
3
import throttle from 'lodash.throttle'
4
4
@@ -35,8 +35,8 @@ function getAnchors () {
35
35
return {
36
36
el,
37
37
hash : decodeURIComponent ( el . hash ) ,
38
- top : el . getBoundingClientRect ( ) . top - 90
39
- /* 90 is to Subtract height of navbar & anchor's padding top */
38
+ top : el . getBoundingClientRect ( ) . top - AHL_TOP_OFFSET
39
+ /* AHL_TOP_OFFSET is to Subtract height of navbar & anchor's padding top */
40
40
}
41
41
} )
42
42
}
Original file line number Diff line number Diff line change @@ -18,7 +18,18 @@ yarn add -D @vuepress/plugin-active-header-links
18
18
19
19
``` javascript
20
20
module .exports = {
21
- plugins: [' @vuepress/active-header-links' ]
21
+ plugins: [' @vuepress/active-header-links' ]
22
+ }
23
+ ```
24
+
25
+ ### Passing Options
26
+ ``` javascript
27
+ module .exports = {
28
+ plugins: [' @vuepress/active-header-links' , {
29
+ sidebarLinkSelector: ' .sidebar-link' ,
30
+ headerAnchorSelector: ' .header-anchor' ,
31
+ headerTopOffset: 120
32
+ }]
22
33
}
23
34
```
24
35
@@ -32,5 +43,11 @@ module.exports = {
32
43
### headerAnchorSelector
33
44
34
45
- Type: ` string `
35
- - Default: ` .header-anchor' `
46
+ - Default: ` .header-anchor `
47
+
48
+ ### headerTopOffset
49
+ The number of pixels that you want the header to be from the top of the page before updating the url hash switch to that header.
50
+
51
+ - Type: ` integer `
52
+ - Default: ` 90 `
36
53
You can’t perform that action at this time.
0 commit comments