Skip to content

Commit cb4cea2

Browse files
committed
Tweak the nav js to cope with page refreshes
1 parent c99178c commit cb4cea2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

themes/CodeMeta-Pyramids/static/js/codemeta.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@
88

99
const headerEl = document.querySelector('#sectionsNav');
1010

11-
window.addEventListener('scroll', () => {
11+
function manageNav() {
1212
if (window.scrollY > 50) {
1313
headerEl.classList.remove('navbar-transparent');
1414
} else if (window.scrollY < 50) {
1515
headerEl.classList.add('navbar-transparent');
1616
}
17-
17+
}
18+
19+
if (performance.navigation.type == performance.navigation.TYPE_RELOAD) {
20+
manageNav();
21+
}
22+
23+
window.addEventListener('scroll', () => {
24+
manageNav();
1825
});

0 commit comments

Comments
 (0)