Skip to content

Commit

Permalink
Fix Issue fniessen#98
Browse files Browse the repository at this point in the history
When elements in the table of contents are clicked in readtheorg
theme, the children are toggled.
  • Loading branch information
ayys committed Jun 1, 2020
1 parent 3a1995b commit 474852d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions styles/readtheorg/js/readtheorg.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
function collapse_toc_elements_on_click (nav_li_a){
/*
When an `a' element in the TOC is clicked, it's parent
`li' element's active attribute is toggled. This causes
the element to toggle between minimized and maximized
states. The active attribute is documented in bootstrap.
https://getbootstrap.com/docs/4.0/components/navbar/#nav
*/
$(nav_li_el).parent().toggleClass("active");
}

$( document ).ready(function() {
// when the document is loaded and ready, bind the
// function `collapse_toc_elements_on_click' to the
// `a' elements in the table of contents.
$("#text-table-of-contents a").click(function() {
collapse_toc_elements_on_click(this);
});
});

$(function() {
$('.note').before("<p class='admonition-title note'>Note</p>");
$('.seealso').before("<p class='admonition-title seealso'>See also</p>");
Expand Down

0 comments on commit 474852d

Please sign in to comment.