Skip to content

Commit 29c2a6d

Browse files
Update script.js
1 parent 0d00302 commit 29c2a6d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

script.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,15 @@
2828
document.querySelectorAll('.cta-bot').forEach(a => {
2929
a.href='https://t.me/MetridexBot'; a.target='_blank'; a.rel='noopener';
3030
});
31+
32+
// Compensate body padding for fixed nav exact height
33+
const nav = document.getElementById('siteNav');
34+
function setOffset(){
35+
if(!nav) return;
36+
const h = nav.getBoundingClientRect().height || 72;
37+
document.body.classList.add('has-fixed-nav');
38+
document.body.style.paddingTop = h + 'px';
39+
}
40+
window.addEventListener('load', setOffset);
41+
window.addEventListener('resize', setOffset);
3142
})();

0 commit comments

Comments
 (0)