You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
729 B
20 lines
729 B
{{ if and (isset .Params "toc") .Params.toc }}
|
|
<details>
|
|
<summary>Table of Contents</summary>
|
|
{{ .TableOfContents }}
|
|
</details>
|
|
<script>
|
|
const el = document.querySelector('details summary')
|
|
el.onclick = () => {
|
|
(function(l,o,a,d,e,r){e=o.createElement(a),r=o.getElementsByTagName(a)[0];e.async=1;e.src=d;r.parentNode.insertBefore(e,r)})(window,document,'script','/js/smoothscroll.js');
|
|
el.onclick = null
|
|
}
|
|
document.querySelectorAll('#TableOfContents a').forEach(link => {
|
|
link.addEventListener('click', () => {
|
|
document.querySelector(
|
|
link.href.slice(link.href.indexOf('#'))
|
|
).scrollIntoView({ behavior: 'smooth' })
|
|
})
|
|
})
|
|
</script>
|
|
{{ end }}
|
|
|