mirror of
https://github.com/asimonson1125/asimonson1125.github.io.git
synced 2026-02-25 05:09:49 -06:00
minimize and scroll on navigation
This commit is contained in:
@@ -3,10 +3,16 @@ function onLoaded() {
|
|||||||
console.log("loaded trigger");
|
console.log("loaded trigger");
|
||||||
document.body.scrollTop = 0; // For Safari
|
document.body.scrollTop = 0; // For Safari
|
||||||
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
||||||
|
let navs = document.querySelectorAll('.navElement');
|
||||||
|
navs.forEach(function (element) {
|
||||||
|
element.onclick = function () {
|
||||||
|
toggleMenu();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
window.onresize = function () { resizer() };
|
window.onresize = function () { resizer() };
|
||||||
resizer();
|
resizer();
|
||||||
if(window.innerWidth < 1200){
|
if (window.innerWidth < 1200) {
|
||||||
const e = document.querySelector(".navControl");
|
const e = document.querySelector(".navControl");
|
||||||
e.style.maxHeight = '0px';
|
e.style.maxHeight = '0px';
|
||||||
}
|
}
|
||||||
@@ -45,6 +51,7 @@ function scrollFunction() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function toggleMenu() {
|
export function toggleMenu() {
|
||||||
|
if (window.innerWidth < 1200) {
|
||||||
const e = document.querySelector(".navControl");
|
const e = document.querySelector(".navControl");
|
||||||
const bar = document.querySelector(".header");
|
const bar = document.querySelector(".header");
|
||||||
if (e.style.maxHeight === '0px') {
|
if (e.style.maxHeight === '0px') {
|
||||||
@@ -54,4 +61,5 @@ export function toggleMenu() {
|
|||||||
e.style.maxHeight = '0px';
|
e.style.maxHeight = '0px';
|
||||||
bar.style.borderBottomWidth = '3px';
|
bar.style.borderBottomWidth = '3px';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user