From 523899e15ccf8ab825b46df34e74f520e0aeb3ec Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Sat, 12 Dec 2020 16:27:48 -0700 Subject: [PATCH] adjust height of nav panel when activating, if necessary --- src/js/01-nav.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/01-nav.js b/src/js/01-nav.js index c73a808..a31d820 100644 --- a/src/js/01-nav.js +++ b/src/js/01-nav.js @@ -106,6 +106,9 @@ function showNav (e) { if (navToggle.classList.contains('is-active')) return hideNav(e) + var navBounds = nav.getBoundingClientRect() + var expectedNavHeight = window.innerHeight - Math.round(navBounds.top) + if (Math.round(navBounds.height) !== expectedNavHeight) nav.style.height = expectedNavHeight + 'px' var html = document.documentElement html.classList.add('is-clipped--nav') navToggle.classList.add('is-active') @@ -142,7 +145,6 @@ function findNextElement (from, selector) { var el = from.nextElementSibling - if (!el) return - return selector ? el[el.matches ? 'matches' : 'msMatchesSelector'](selector) && el : el + return el && selector ? el[el.matches ? 'matches' : 'msMatchesSelector'](selector) && el : el } })() -- 2.11.0