Navbar update

This commit is contained in:
2024-02-25 15:30:32 -06:00
parent 7f95fdc4ca
commit be738e2e65
6 changed files with 430 additions and 62 deletions

View File

@@ -2,36 +2,19 @@ window.onload = function () {
onLoaded();
};
function onLoaded() {
// document.body.scrollTop = 0; // For Safari
// document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
window.onresize = function () {
resizer();
};
resizer();
if (window.innerWidth < 1400) {
const e = document.querySelector(".navControl");
e.style.maxHeight = "0px";
}
}
function resizer() {
const e = document.querySelector(".navControl");
if (window.innerWidth > 1400) {
// desktop view
scrollFunction();
window.onscroll = function () {
scrollFunction();
};
e.style.maxHeight = `${e.scrollHeight + 10}px`;
} else {
// mobile view
window.onscroll = "";
document.querySelector(".header").style.backgroundColor = "#1a1a1a";
document.querySelectorAll(".header .name h1").forEach(function (x) {
x.style.fontSize = "1.5rem";
});
// document.querySelector('.header > h1').style.color = "#ecebeb";
document.querySelector(".header").style.borderBottomWidth = "3px";
e.style.maxHeight = "0px";
document.querySelectorAll(".navElement *").forEach((x) => {
@@ -42,31 +25,6 @@ function resizer() {
}
}
function scrollFunction() {
if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10) {
document.querySelector(".header").style.backgroundColor = "#1a1a1a";
document.querySelectorAll(".header .name h1").forEach(function (x) {
x.style.fontSize = "1.5rem";
});
document.querySelectorAll(".navElement *").forEach((x) => {
x.style.paddingTop = ".3rem";
x.style.paddingBottom = ".3rem";
x.style.fontSize = "1rem";
});
} else {
document.querySelector(".header").style.backgroundColor = "rgba(0,0,0,0)";
document.querySelectorAll(".header .name h1").forEach(function (x) {
x.style.fontSize = "2rem";
});
// document.querySelector('.header > h1').style.color = "#ecebeb";
document.querySelectorAll(".navElement *").forEach((x) => {
x.style.paddingTop = ".5rem";
x.style.paddingBottom = ".5rem";
x.style.fontSize = "1.2rem";
});
}
}
function toggleMenu() {
if (window.innerWidth < 1400) {
const e = document.querySelector(".navControl");