Scroll to the current section in the sidebar

This commit is contained in:
Zakary Kamal Ismail
2019-07-28 16:31:44 -04:00
parent ca3a1bf995
commit ecfcbc3ed5

View File

@@ -12,7 +12,7 @@
<nav class="sidebar__nav">
<div class="sidebar__nav-interior">
{%- for section in sections -%}
<h3 class="section__header">{{ section | capitalize }}</h3>
<h3 class="section__header" id="{{ section }}">{{ section | capitalize }}</h3>
<ul class="section__links">
{%- for item in site[section] -%}
@@ -23,5 +23,11 @@
</ul>
{%- endfor -%}
</div>
{%- if sections contains page.collection -%}
<script type="text/javascript">
document.getElementById("{{ page.collection }}").scrollIntoView();
</script>
{%- endif -%}
</nav>
</div>