Skip to content

Commit c24fec6

Browse files
johndmulhausenMisty Stanley-Jones
authored andcommitted
Move to pre-rendered left-navs instead of post-load JS for TOC sync
1 parent 92f1c95 commit c24fec6

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

_includes/tree.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
{% for item in tree %}{% if item.heading %}{% else %}{% if item.sectiontitle %}<li class="leaf menu-closed"><a href="javascript:void(0)" class="expand-menu "><span class="menu-icon" aria-hidden="true"></span>{{ item.sectiontitle }}</a>
1+
{% for item in tree %}{% if item.sectiontitle %}{% capture treeString %}{{ item.section | downcase }}{% endcapture %}{% capture pageURLString %}"{{ page.url }}"{% endcapture %}
2+
<li class="leaf {% if treeString contains pageURLString %}menu-open{% else %}menu-closed{% endif %}"><a href="javascript:void(0)" class="expand-menu "><span class="menu-icon" aria-hidden="true"></span>{{ item.sectiontitle }}</a>
23
<ul class="nav-sub">
34
{% assign tree = item.section %}{% include tree.html %}
45
</ul>
56
{% else %}
6-
<li class="leaf"><a href="{{ item.path }}" class="{% if item.path == page.url and item.nosync != true %}active currentPage{% endif %}">{{ item.title }}</a></li>{% endif %}{% endif %}{% endfor %}
7+
<li class="leaf"><a href="{{ item.path }}" class="{% if item.path == page.url and item.nosync != true %}active currentPage{% endif %}">{{ item.title }}</a></li>{% endif %}{% endfor %}

js/menu.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ function hookupTOCEvents()
5656
}
5757
return false;
5858
});
59-
$(".currentPage").each(function(){
60-
$(this).parentsUntil($('.docsidebarnav_section')).addClass("active").removeClass("menu-closed").addClass("menu-open");
61-
});
6259
$(".left-off-canvas-menu").css("display","block");
6360
// console.log(metadata);
6461
$("#st-search-input").on('keyup change', function(e) {

0 commit comments

Comments
 (0)