| {{ partial "page-meta-links.html" . }} |
| {{ if not .Params.notoc }} |
| {{ with .TableOfContents }} |
| {{ if ge (len .) 200 }} |
| {{ . }} |
| {{ end }} |
| {{ end }} |
| {{ end }} |
| |
| <script> |
| $(function () { |
| var $toc = $("#TableOfContents"); |
| if (!$toc || !$toc.length) { |
| return; |
| } |
| var top = $toc.offset().top; |
| |
| window.onscroll = debounce(setTop) |
| |
| function setTop() { |
| var scrollValue = $(window).scrollTop(); |
| if (scrollValue >= top - 70) { |
| $toc.addClass('fix') |
| } else { |
| $toc.removeClass('fix') |
| } |
| } |
| |
| function debounce(fn, wait = 200) { |
| var timeout = null; |
| return function () { |
| clearTimeout(timeout); |
| timeout = setTimeout(() => { |
| fn.apply(this, arguments); |
| }, wait); |
| }; |
| } |
| }) |
| |
| </script> |