From 474852d59b49b5078ef4c4b78c16b09e09c28643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=86=E0=A4=AF=E0=A5=81=E0=A4=B7=20=E0=A4=9D=E0=A4=BE?= Date: Mon, 1 Jun 2020 16:25:51 +0545 Subject: [PATCH] Fix Issue #98 When elements in the table of contents are clicked in readtheorg theme, the children are toggled. --- styles/readtheorg/js/readtheorg.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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

");