diff --git a/styles/readtheorg/js/readtheorg.js b/styles/readtheorg/js/readtheorg.js index 6dff6c4..851e302 100644 --- a/styles/readtheorg/js/readtheorg.js +++ b/styles/readtheorg/js/readtheorg.js @@ -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("

Note

"); $('.seealso').before("

See also

");