diff --git a/static/index.js b/static/index.js index b8b04c5e0..a451112f7 100644 --- a/static/index.js +++ b/static/index.js @@ -12,8 +12,26 @@ const handleClick = () => { } +const handleNavClick = (event) => { + event.target.classList.toggle("fa-rotate-90") + const items = event.target.parentNode.children + for(const item of items) { + if(item.localName == "ul") { + for(const child of item.children) { + child.classList.toggle("hidden") + } + } + } +} + const main = () => { document.getElementById("navigation-button").addEventListener("click", handleClick) + + const toggles = document.getElementsByClassName("nav-toggle") + for(const item of toggles) { + item.addEventListener("click", handleNavClick); + } + } window.onload = main; \ No newline at end of file diff --git a/templates/macros.html b/templates/macros.html index fb55aeada..062643cc6 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -13,7 +13,7 @@ {%- set renderAll = false %} {%- for page in currentPage.ancestors %} {%- set iteratorSection = get_section(path=page) %} - {%- if iteratorSection.path == subsection.path or iteratorSection.path == subsectionParent.path %} + {%- if iteratorSection.path == subsectionParent.path %} {%- set_global renderAll = true %} {%- break %} {%- endif %} @@ -40,8 +40,13 @@ {%- set class = class ~ " text-title" %} {%- endif -%} + {%- set iconClass = "" -%} + {%- if currentPage.ancestors is containing(subsection.relative_path) or current_path == subsection.path -%} + {%- set iconClass = "fa-rotate-90" -%} + {%- endif -%} +