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
20
js/utils.js
20
js/utils.js
|
@ -977,12 +977,14 @@ function show_tab(target, tabs) {
|
||||||
|
|
||||||
// mobile navbar appearance control
|
// mobile navbar appearance control
|
||||||
let scrollPos = 0
|
let scrollPos = 0
|
||||||
document.addEventListener('scroll', (e) => {
|
if (screen.width < 992) {
|
||||||
if (document.documentElement.scrollTop - scrollPos > 20) {
|
document.addEventListener('scroll', (e) => {
|
||||||
document.getElementById("mobile-navbar").style.display = "none";
|
if (document.documentElement.scrollTop - scrollPos > 20) {
|
||||||
document.getElementById("mobile-navbar-dropdown").style.display = "none";
|
document.getElementById("mobile-navbar").style.display = "none";
|
||||||
} else if (document.documentElement.scrollTop - scrollPos < -50) {
|
document.getElementById("mobile-navbar-dropdown").style.display = "none";
|
||||||
document.getElementById("mobile-navbar").style.display = "";
|
} else if (document.documentElement.scrollTop - scrollPos < -50 || scrollPos < 70) {
|
||||||
}
|
document.getElementById("mobile-navbar").style.display = "";
|
||||||
scrollPos = document.documentElement.scrollTop;
|
}
|
||||||
});
|
scrollPos = document.documentElement.scrollTop;
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue