Skip to content

Commit

Permalink
Fixed scroll issue for iOS and hopefully didn't break other devices -…
Browse files Browse the repository at this point in the history
… DP-20209
  • Loading branch information
tom-fleming committed Oct 15, 2020
1 parent 336c516 commit 40dc92b
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions patternlab/styleguide/source/assets/js/modules/mainNavHamburger.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,7 @@ let hamburgerMenuAlertScrolling = function() {
let alertHeight = document.querySelector(".ma__emergency-alerts").clientHeight || 0;
let hamburgerMenuTop = document.querySelector(".ma__header__hamburger__nav-container").offsetTop || 0;
let paddingTarget = hamburgerMainNav;

if (utilNavNarrowCheck() !== false) {
paddingTarget = utilNarrowNav;
if (width < 841) {
paddingTarget.style.paddingBottom = "80px";
}
hamburgerMainNav.style.paddingBottom = 0;
}
else {
// Add bottom padding when function is initially called.
paddingTarget.style.paddingBottom = alertHeight + hamburgerMenuTop + "px";
}
paddingTarget.style.paddingBottom = alertHeight + hamburgerMenuTop + "px";

// Add bottom padding when alert style changes occur.
const alertObserver = new MutationObserver(function(mutations) {
Expand All @@ -58,6 +47,7 @@ let hamburgerMenuAlertScrolling = function() {
}
if (utilNavNarrowCheck() !== false) {
paddingTarget = utilNarrowNav;

hamburgerMainNav.style.paddingBottom = 0;
}

Expand All @@ -66,9 +56,6 @@ let hamburgerMenuAlertScrolling = function() {
if (currentDisplayValue === oldDisplayValue) {
alertHeight = document.querySelector(".ma__emergency-alerts").clientHeight;
paddingTarget.style.paddingBottom = alertHeight + hamburgerMenuTop + "px";
if (width < 841) {
paddingTarget.style.paddingBottom = "80px";
}
}
}
});
Expand Down

0 comments on commit 40dc92b

Please sign in to comment.