Skip to content

Commit

Permalink
feat: Only hide the navigation when resizing horizontally
Browse files Browse the repository at this point in the history
  • Loading branch information
petesfrench committed Aug 14, 2024
1 parent 38ebde7 commit 83d23ba
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions static/js/navigation/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,18 @@ var throttle = function (fn, delay) {
};
};

// hide navigation when screen is resized
window.addEventListener("resize", throttle(closeAllNavigationItems, 10));
// Hide navigation when screen is horizontally resized
let previousWidth = window.innerWidth;
window.addEventListener(
"resize",
throttle(function () {
const currentWidth = window.innerWidth;
if (currentWidth !== previousWidth) {
closeAllNavigationItems();
previousWidth = currentWidth;
}
}, 10)
);

// Update careers dropdown with latest avaiable roles
populateCareersRoles();
Expand Down

0 comments on commit 83d23ba

Please sign in to comment.