Skip to content

Commit

Permalink
only apply the scroll check if the header type is set to scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
markconroy committed Jul 16, 2024
1 parent 2b26087 commit f5a71c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/sticky-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
calculatePositions();
}

window.addEventListener('scroll', handleScroll);
if (header.closest('body').classList.contains('sticky-header--scroll')) {
window.addEventListener('scroll', handleScroll);
}

setTimeout(() => {
calculatePositions();
Expand Down

0 comments on commit f5a71c6

Please sign in to comment.