Skip to content

Commit

Permalink
run 07-scrollable0header-nav.js when resizing and scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
yfanti committed May 16, 2024
1 parent 7a425a8 commit a65149b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/js/07-scrollable-header-nav.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
window.addEventListener('scroll', function () {
function adjustNav () {
const nav = document.querySelector('.nav')
const navMenu = document.querySelector('.nav-panel-menu')
const navExplore = document.querySelector('.nav-panel-explore')
Expand Down Expand Up @@ -38,4 +38,7 @@ window.addEventListener('scroll', function () {
// Apply the calculated height to the div
nav.style.height = calculatedHeight + 'px'
navMenu.style.height = divMenuHeight + 'px'
})
}

window.addEventListener('scroll', adjustNav)
window.addEventListener('resize', adjustNav)

0 comments on commit a65149b

Please sign in to comment.