Skip to content

Commit

Permalink
Adding promo height to top of sticky table
Browse files Browse the repository at this point in the history
  • Loading branch information
bandana147 committed Jan 22, 2025
1 parent 4bb942f commit 2c8599a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { PERSONALIZATION_TAGS } from '../../../features/personalization/personal
loadLana();

const FEDERAL_PATH_KEY = 'federal';
// Set a default height for LocalNav, as some sticky blocks position themselves before LocalNav loads into the DOM.
const DEFAULT_LOCALNAV_HEIGHT = 40;

const selectorMap = {
headline: '.feds-menu-headline[aria-expanded="true"]',
Expand Down Expand Up @@ -563,11 +565,13 @@ export function getGnavHeight() {
let topHeight = document.querySelector('header').offsetHeight;
if (isLocalNav()) {
const localNav = document.querySelector('.feds-localnav');
topHeight = localNav.offsetHeight || 40;
topHeight = localNav.offsetHeight || DEFAULT_LOCALNAV_HEIGHT;
}
if (fedsPromo) {
const fedsPromo = document.querySelector('.feds-promo-wrapper');

const fedsPromo = document.querySelector('.feds-promo-aside-wrapper');
if (fedsPromo instanceof HTMLElement ) {
topHeight += fedsPromo.offsetHeight;
}

return topHeight;
}

0 comments on commit 2c8599a

Please sign in to comment.