From 0531502b7d3a669ec1297352491b05803e913da7 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 8 Jul 2018 23:53:33 +0200 Subject: [PATCH] dynamic height of asidenav to avoid over-long bodies --- templates/widgets/asidenav.julius | 15 +++++++++++++++ templates/widgets/asidenav.lucius | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/templates/widgets/asidenav.julius b/templates/widgets/asidenav.julius index 772e1b455..843f2eba9 100644 --- a/templates/widgets/asidenav.julius +++ b/templates/widgets/asidenav.julius @@ -19,6 +19,21 @@ document.addEventListener('DOMContentLoaded', function() { var asidenavEl = document.querySelector('.main__aside'); + var mainContentEl = document.querySelector('.main__content'); + + function adjustHeight() { + window.requestAnimationFrame(function() { + asidenavEl.style.height = mainContentEl.clientHeight + 'px'; + }); + } + + // unbeknownst to the user (below the fold), this happes slightly delayed + // because of dynamic changes to the styles inside the main__content + setTimeout(function() { + adjustHeight(); + }, 10); + + window.addEventListener('resize', adjustHeight); window.utils.aside(asidenavEl); diff --git a/templates/widgets/asidenav.lucius b/templates/widgets/asidenav.lucius index bd0f56872..781bd1742 100644 --- a/templates/widgets/asidenav.lucius +++ b/templates/widgets/asidenav.lucius @@ -16,6 +16,13 @@ } } +@media (max-width: 768px) { + + .main__aside { + min-height: calc(100% - var(--header-height-collapsed)); + } +} + @media (max-width: 425px) { .main__aside {