diff options
author | Ian Lewis <ianlewis@google.com> | 2021-03-24 17:54:45 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-24 17:56:40 -0700 |
commit | e4772bd84512c03ca431701dc139e126a885abd4 (patch) | |
tree | 2c9aca575d936f3506aac5da9ea21cecad83fb52 /website/_includes | |
parent | e7ca2a51a89a8ff2c9f5adfdfa5b51be1b3faeb3 (diff) |
Fix highlighting sidebar menu on the website
Highlighting previously highlighted multiple items in the sidebar if the had
the same page name (not full url). This change simplifies this by adding the
highlight class in the jekyll template rather than javascript, and highlights
only the correct page.
PiperOrigin-RevId: 364931350
Diffstat (limited to 'website/_includes')
-rw-r--r-- | website/_includes/footer.html | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/website/_includes/footer.html b/website/_includes/footer.html index c1a373329..20aa9f52c 100644 --- a/website/_includes/footer.html +++ b/website/_includes/footer.html @@ -27,25 +27,6 @@ if (!doNotTrack) { }; window.addEventListener("hashchange", shiftWindow); - var highlightCurrentSidebarNav = function() { - var href = location.pathname; - var item = $('#sidebar-nav [href$="' + href + '"]'); - if (item) { - var li = item.parent(); - li.addClass("active"); - - if (li.parent() && li.parent().is("ul")) { - do { - var ul = li.parent(); - if (ul.hasClass("collapse")) { - ul.collapse("show"); - } - li = ul.parent(); - } while (li && li.is("li")); - } - } - }; - $(document).ready(function() { // Scroll to anchor of location hash, adjusted for fixed navbar. window.setTimeout(function() { @@ -65,8 +46,5 @@ if (!doNotTrack) { toggle.removeClass("dropup"); } }); - - // Highlight the current page on the sidebar nav. - highlightCurrentSidebarNav(); }); </script> |