From 6e25ea8a9c2e0cd6314164b4fe1f0aef069dc5e2 Mon Sep 17 00:00:00 2001 From: Jan Brasna <1784648+janbrasna@users.noreply.github.com> Date: Wed, 4 Dec 2024 21:36:10 +0100 Subject: [PATCH 1/3] Update m24-nav sticky scrolling condition --- media/js/base/protocol/m24-navigation.es6.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/media/js/base/protocol/m24-navigation.es6.js b/media/js/base/protocol/m24-navigation.es6.js index e27464e14e0..1b444572b5e 100644 --- a/media/js/base/protocol/m24-navigation.es6.js +++ b/media/js/base/protocol/m24-navigation.es6.js @@ -122,8 +122,8 @@ MzpNavigation.initSticky = () => { * user scrolls up and down the viewport. */ MzpNavigation.checkScrollPosition = () => { - // add styling for when scrolling the viewport - if (window.scrollY > 0) { + // add styling for when scrolling the viewport and nav is already sticking + if (window.scrollY > 0 && _navElem.getBoundingClientRect().top == 0) { _navElem.classList.add('mzp-is-scrolling'); } else { _navElem.classList.remove('mzp-is-scrolling'); From 48f32480ebb592ecea12bb48930d55d988e0b31e Mon Sep 17 00:00:00 2001 From: Jan Brasna <1784648+janbrasna@users.noreply.github.com> Date: Wed, 4 Dec 2024 21:58:38 +0100 Subject: [PATCH 2/3] Allow for some less precision --- media/js/base/protocol/m24-navigation.es6.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/js/base/protocol/m24-navigation.es6.js b/media/js/base/protocol/m24-navigation.es6.js index 1b444572b5e..589125c704f 100644 --- a/media/js/base/protocol/m24-navigation.es6.js +++ b/media/js/base/protocol/m24-navigation.es6.js @@ -123,7 +123,7 @@ MzpNavigation.initSticky = () => { */ MzpNavigation.checkScrollPosition = () => { // add styling for when scrolling the viewport and nav is already sticking - if (window.scrollY > 0 && _navElem.getBoundingClientRect().top == 0) { + if (window.scrollY > 0 && _navElem.getBoundingClientRect().top < 1) { _navElem.classList.add('mzp-is-scrolling'); } else { _navElem.classList.remove('mzp-is-scrolling'); From 391216e27f5835a919c6f01b91a63792787f50c4 Mon Sep 17 00:00:00 2001 From: Jan Brasna <1784648+janbrasna@users.noreply.github.com> Date: Wed, 4 Dec 2024 22:49:49 +0100 Subject: [PATCH 3/3] Add shadow transition --- media/css/m24/components/navigation-refresh.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/css/m24/components/navigation-refresh.scss b/media/css/m24/components/navigation-refresh.scss index 5f782a54616..ed7875d9e09 100644 --- a/media/css/m24/components/navigation-refresh.scss +++ b/media/css/m24/components/navigation-refresh.scss @@ -46,7 +46,7 @@ $margin-top: 54px; // top margin offset for mobile navigation menu z-index: 1000; left: 0; top: 0; - @include transition(transform 300ms ease-in-out); + @include transition(transform 300ms ease-in-out, box-shadow 300ms ease-in-out); &.mzp-is-scrolling { // Shadow colors are equivalent to $color-ink-90, $color-blue-90, $color-ink-90