Skip to content

Commit

Permalink
enh: Expand animations for submenus in toc
Browse files Browse the repository at this point in the history
  • Loading branch information
TEParsons committed Oct 13, 2024
1 parent e8d0bc1 commit 82afd19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
23 changes: 15 additions & 8 deletions mkdocs_landing/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,24 +143,31 @@ nav#toc {
nav#toc ul {
list-style-type: none;
}
nav#toc li {
margin-bottom: .5rem;
}
nav#toc a {
display: block;
white-space: nowrap;
margin: 0.5rem 0;
}
nav#toc + * {
margin-top: 0;
}

nav#toc .toc-subitem a {
display: inline;
color: var(--text);
opacity: 35%;
}
nav#toc .toc-subitem {
display: none;

nav#toc .toc-item ul {
overflow-y: hidden;
transition: transform 0.25s ease;
transform-origin: top center;
transform: scaleY(0);
height: 0;
}
nav#toc .toc-item:hover .toc-subitem {
display: inline;
nav#toc .toc-item:hover ul {
transition: transform 0.25s ease;
transform: scaleY(1);
height: auto;
}


Expand Down
4 changes: 2 additions & 2 deletions mkdocs_landing/partials/toc.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% if config.theme.toc_level > 0 %}
{% for toc_item in page.toc %}
<ul>
{% for toc_item in page.toc %}
<li class="toc-item">
<a href="{{ toc_item.url }}">{{ toc_item.title }}</a>
{% if config.theme.toc_level > 1 %}
Expand All @@ -15,6 +15,6 @@
</ul>
{% endif %}
</li>
</ul>
{% endfor %}
</ul>
{% endif %}

0 comments on commit 82afd19

Please sign in to comment.