fix: tocbot
This commit is contained in:
parent
71e1c2149d
commit
7fcdbf8722
@ -16,11 +16,14 @@
|
|||||||
headingSelector: 'h1, h2, h3, h4, h5, h6',
|
headingSelector: 'h1, h2, h3, h4, h5, h6',
|
||||||
hasInnerContainers: true,
|
hasInnerContainers: true,
|
||||||
scrollSmooth: true,
|
scrollSmooth: true,
|
||||||
|
scrollContainer:'main',
|
||||||
positionFixedSelector: '.tocbot',
|
positionFixedSelector: '.tocbot',
|
||||||
positionFixedClass: 'is-position-fixed',
|
positionFixedClass: 'is-position-fixed',
|
||||||
fixedSidebarOffset: 'auto',
|
fixedSidebarOffset: 'auto',
|
||||||
onClick: (e) => {
|
onClick: (e) => {
|
||||||
document.getElementById(e.target.innerText).scrollIntoView()
|
$('.toc-link').removeClass('is-active-link');
|
||||||
|
$(`a[href=${e.target.hash}]`).addClass('is-active-link');
|
||||||
|
$(e.target.hash).scrollIntoView();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
.tocbot
|
.tocbot
|
||||||
position fixed
|
position absolute
|
||||||
top 14rem
|
top 14rem
|
||||||
left calc((100vw - 70rem) / 2 + 70rem)
|
left calc((100vw - 70rem) / 2 + 70rem)
|
||||||
font-size 80%
|
font-size 80%
|
||||||
@ -47,3 +47,9 @@ a.toc-link
|
|||||||
margin-top -1px
|
margin-top -1px
|
||||||
position absolute
|
position absolute
|
||||||
width 2px
|
width 2px
|
||||||
|
|
||||||
|
.is-active-link::before
|
||||||
|
background-color sea-blue
|
||||||
|
|
||||||
|
.is-active-link
|
||||||
|
font-weight 700
|
Loading…
Reference in New Issue
Block a user