Permalink
Browse files

Only change current if a matching link is found (#472)

  • Loading branch information...
petermd authored and Blendify committed Oct 13, 2017
1 parent 896fe3e commit ee4d4403755b8d4ffb7813fd96e92c4b85752b72
Showing with 8 additions and 6 deletions.
  1. +8 −6 js/theme.js
View
@@ -108,13 +108,15 @@ function ThemeNav () {
// Try again with the closest section entry.
link = $('.wy-menu-vertical')
.find('[href="#' + closest_section.attr("id") + '"]');
}
$('.wy-menu-vertical li.toctree-l1 li.current')
.removeClass('current');
link.closest('li.toctree-l2').addClass('current');
link.closest('li.toctree-l3').addClass('current');
link.closest('li.toctree-l4').addClass('current');
// If we found a matching link then reset current and re-apply
// otherwise retain the existing match
if (link.length > 0) {
$('.wy-menu-vertical li.toctree-l1 li.current').removeClass('current');
link.closest('li.toctree-l2').addClass('current');
link.closest('li.toctree-l3').addClass('current');
link.closest('li.toctree-l4').addClass('current');
}
}
catch (err) {
console.log("Error expanding nav for anchor", err);

0 comments on commit ee4d440

Please sign in to comment.