Skip to content

Commit

Permalink
Set navigation content height universally since it won't change [PUB-229
Browse files Browse the repository at this point in the history
]
  • Loading branch information
nikhiltri committed Aug 22, 2024
1 parent 1d1516e commit ae02170
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/js/behaviors/core/stickyDigitalPublicationHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@ const stickyDigitalPublicationHeader = function(container) {
let currentState;
let containerOffsetHeight;
let scrollTop;
let navContainerHeight;

function handleScroll() {
window.requestAnimationFrame(update);
}

function handleResize() {
containerOffsetHeight = getOffsetTop(container) + container.offsetHeight;
navContainerHeight = document.querySelector('.g-header').clientHeight;
handleScroll();
}

function update() {
let navContainerHeight = document.querySelector('.g-header').clientHeight;
scrollTop = document.documentElement.scrollTop || document.body.scrollTop;

if (scrollTop < navContainerHeight) {
Expand Down

0 comments on commit ae02170

Please sign in to comment.