From 171d068a789bf221b4422ede048aaa1c9349228c Mon Sep 17 00:00:00 2001 From: reschan Date: Tue, 2 Aug 2022 13:25:57 +0700 Subject: [PATCH] implement mobile navbar --- builder/index_full.html | 45 ++++++++++++++++++++++++++++++++++++++++- js/builder.js | 12 +++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/builder/index_full.html b/builder/index_full.html index 5fa94d0..0f241bb 100644 --- a/builder/index_full.html +++ b/builder/index_full.html @@ -36,7 +36,50 @@
WB DiscordWB Discord -
+ +
Join the discord today to suggest new features, submit bug reports, and hangout/talk to devs!
diff --git a/js/builder.js b/js/builder.js index 468b642..81a64a6 100644 --- a/js/builder.js +++ b/js/builder.js @@ -384,6 +384,18 @@ function init() { break; } } + + // navbar appearance control + let scrollPos = 0 + document.addEventListener('scroll', (e) => { + if (document.documentElement.scrollTop - scrollPos > 20) { + document.getElementById("mobile-navbar").style.display = "none"; + document.getElementById("mobile-navbar-dropdown").style.display = "none"; + } else if (document.documentElement.scrollTop - scrollPos < -50) { + document.getElementById("mobile-navbar").style.display = ""; + } + scrollPos = document.documentElement.scrollTop; + }); } window.onerror = function(message, source, lineno, colno, error) {