2023-09-29 01:10:05 +00:00
|
|
|
let prevScrollpos = window.pageYOffset;
|
|
|
|
window.onscroll = function () {
|
|
|
|
const currentScrollPos = window.pageYOffset;
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2022-12-04 15:40:32 +00:00
|
|
|
const topBar = document.getElementById("fixed-bar-mobile");
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2022-12-04 15:40:32 +00:00
|
|
|
const bottomBar = document.getElementById("mobile-bottom-navigation-bar");
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2022-12-04 15:40:32 +00:00
|
|
|
const dropdown = document.getElementById("mobileSortDropdown");
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2022-12-04 15:40:32 +00:00
|
|
|
const navbar = document.getElementById("navbar");
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2023-06-30 19:39:19 +00:00
|
|
|
const bottomSafeAreaInset = parseInt(getComputedStyle(bottomBar).getPropertyValue("--safe-area-inset-bottom")) || 0;
|
|
|
|
|
2022-07-16 21:00:02 +00:00
|
|
|
if (bottomBar != null) {
|
2023-09-29 06:11:18 +00:00
|
|
|
if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
|
2022-07-16 21:00:02 +00:00
|
|
|
bottomBar.style.bottom = "0px";
|
2022-09-04 23:15:37 +00:00
|
|
|
}
|
2023-09-29 06:11:18 +00:00
|
|
|
else if (currentScrollPos <= 125 && (innerHeight + currentScrollPos) < (document.body.offsetHeight - 65)) {
|
2022-07-16 21:00:02 +00:00
|
|
|
bottomBar.style.bottom = "0px";
|
2024-01-14 13:08:27 +00:00
|
|
|
}
|
|
|
|
else if (prevScrollpos > currentScrollPos && (innerHeight + currentScrollPos) >= (document.body.offsetHeight - 65)) {
|
|
|
|
bottomBar.style.bottom = `-${50 + bottomSafeAreaInset}px`;
|
2022-07-16 21:00:02 +00:00
|
|
|
}
|
|
|
|
else {
|
2023-06-30 19:39:19 +00:00
|
|
|
bottomBar.style.bottom = `-${50 + bottomSafeAreaInset}px`;
|
2022-07-16 21:00:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (topBar != null && dropdown != null) {
|
|
|
|
if (prevScrollpos > currentScrollPos) {
|
|
|
|
topBar.style.top = "48px";
|
|
|
|
navbar.classList.remove("shadow");
|
2022-09-04 23:15:37 +00:00
|
|
|
}
|
2022-07-16 21:00:02 +00:00
|
|
|
else if (currentScrollPos <= 125) {
|
|
|
|
topBar.style.top = "48px";
|
|
|
|
navbar.classList.remove("shadow");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
topBar.style.top = "-48px";
|
|
|
|
dropdown.classList.remove('show');
|
|
|
|
navbar.classList.add("shadow");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prevScrollpos = currentScrollPos;
|
2022-12-04 15:40:32 +00:00
|
|
|
}
|