force open navbar when at top of the page
This commit is contained in:
parent
2ec37d3e9d
commit
ae7f93cb88
1 changed files with 11 additions and 9 deletions
|
@ -977,12 +977,14 @@ function show_tab(target, tabs) {
|
||||||
|
|
||||||
// mobile navbar appearance control
|
// mobile navbar appearance control
|
||||||
let scrollPos = 0
|
let scrollPos = 0
|
||||||
|
if (screen.width < 992) {
|
||||||
document.addEventListener('scroll', (e) => {
|
document.addEventListener('scroll', (e) => {
|
||||||
if (document.documentElement.scrollTop - scrollPos > 20) {
|
if (document.documentElement.scrollTop - scrollPos > 20) {
|
||||||
document.getElementById("mobile-navbar").style.display = "none";
|
document.getElementById("mobile-navbar").style.display = "none";
|
||||||
document.getElementById("mobile-navbar-dropdown").style.display = "none";
|
document.getElementById("mobile-navbar-dropdown").style.display = "none";
|
||||||
} else if (document.documentElement.scrollTop - scrollPos < -50) {
|
} else if (document.documentElement.scrollTop - scrollPos < -50 || scrollPos < 70) {
|
||||||
document.getElementById("mobile-navbar").style.display = "";
|
document.getElementById("mobile-navbar").style.display = "";
|
||||||
}
|
}
|
||||||
scrollPos = document.documentElement.scrollTop;
|
scrollPos = document.documentElement.scrollTop;
|
||||||
});
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue