From 0559d77e5a733f34f8802bf553e28f34bdf4c8b5 Mon Sep 17 00:00:00 2001 From: Nihaal Sangha <18350092+nihaals@users.noreply.github.com> Date: Tue, 1 Sep 2020 20:24:03 +0100 Subject: [PATCH] Add sidebar animation when collapsing --- docs/_static/sidebar.js | 7 ++----- docs/_static/style.css | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/_static/sidebar.js b/docs/_static/sidebar.js index c44518f54..d9291a267 100644 --- a/docs/_static/sidebar.js +++ b/docs/_static/sidebar.js @@ -64,19 +64,17 @@ class Sidebar { collapseSection(icon) { icon.classList.remove('expanded'); icon.classList.add('collapsed'); - icon.innerText = 'chevron_right'; let children = icon.nextElementSibling.nextElementSibling; // // --> - children.style.display = "none"; + setTimeout(() => children.style.display = "none", 75) } expandSection(icon) { icon.classList.remove('collapse'); icon.classList.add('expanded'); - icon.innerText = 'expand_more'; let children = icon.nextElementSibling.nextElementSibling; - children.style.display = "block"; + setTimeout(() => children.style.display = "block", 75) } setActiveLink(section) { @@ -127,4 +125,3 @@ document.addEventListener('DOMContentLoaded', () => { sidebar.resize(); }); }); - diff --git a/docs/_static/style.css b/docs/_static/style.css index 995532965..6cd061faa 100644 --- a/docs/_static/style.css +++ b/docs/_static/style.css @@ -361,6 +361,13 @@ aside h3 { user-select: none; position: relative; line-height: 0.5em; + transition: transform 0.4s; + transform: rotate(0deg); +} + +.expanded { + transition: transform 0.4s; + transform: rotate(-90deg); } .ref-internal-padding {