Skip to content

Commit

Permalink
Refresh: Fix nav sticky scrolling styling/condition (#15673)
Browse files Browse the repository at this point in the history
* Update m24-nav sticky scrolling condition

* Allow for some less precision

* Add shadow transition
  • Loading branch information
janbrasna authored Dec 12, 2024
1 parent d667a96 commit 11c0669
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion media/css/m24/components/navigation-refresh.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions media/js/base/protocol/m24-navigation.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 < 1) {
_navElem.classList.add('mzp-is-scrolling');
} else {
_navElem.classList.remove('mzp-is-scrolling');
Expand Down

0 comments on commit 11c0669

Please sign in to comment.