diff options
author | David O'Regan <doregan@gitlab.com> | 2020-06-19 02:21:50 +0300 |
---|---|---|
committer | Evan Read <eread@gitlab.com> | 2020-06-19 02:21:50 +0300 |
commit | 67783d67fac773a3be1ab2a3bf9e40f1692867eb (patch) | |
tree | b175045032ff679705192c9570238ced2998d3ee /content/assets/javascripts/docs.js | |
parent | e6425ce9c161c9e0a500968e3f4cf246850c4b55 (diff) |
Docs sidebar re-design
Diffstat (limited to 'content/assets/javascripts/docs.js')
-rw-r--r-- | content/assets/javascripts/docs.js | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/content/assets/javascripts/docs.js b/content/assets/javascripts/docs.js index e19a305f..61d3c1cb 100644 --- a/content/assets/javascripts/docs.js +++ b/content/assets/javascripts/docs.js @@ -1,5 +1,5 @@ --- -version: 2 +version: 3 --- var NAV_INLINE_BREAKPOINT = 1100; @@ -81,24 +81,5 @@ function toggleNavigation() { } }); - // Adds the ability to auto-scroll to the active item in the TOC - $(window).on('activate.bs.scrollspy', function() { - const isMobile = window.matchMedia('(max-width: 1099px)').matches; - - if(isMobile) { - return; - } - - const activeAnchors = document.querySelectorAll('#markdown-toc .nav-link.active'); - - if(activeAnchors.length) { - const sidebarAnchorOffset = 45; - const lastActiveAnchor = activeAnchors[activeAnchors.length -1]; - const sidebar = document.getElementById('doc-nav'); - // Takes the last active anchor in the tree and scrolls it into view. - lastActiveAnchor.scrollIntoView(); - sidebar.scrollTop -= sidebarAnchorOffset; - } - }); }); })(); |