patch mobile menu

This commit is contained in:
2022-05-21 18:23:20 -04:00
parent de5ae1ede6
commit 08a73e66ef
4 changed files with 7 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ import Activities from './pages/Activities';
import AboutMe from './pages/AboutMe';
import AOS from 'aos';
import 'aos/dist/aos.css'; // You can also use <link> for styles
import './responsive'
AOS.init();
function App() {
@@ -21,7 +22,7 @@ function App() {
<img src={menu} alt="menu" id='menu'/>
<Nav id='navbar'>
<Link to='/'>Home</Link>
<a href='https://github.com/asimonson1125/Resume/raw/main/Resume.pdf' rel='noreferrer' target='_blank'>Resume</a>
<a href='Resume.pdf' target='_blank'>Resume</a>
<Link to='/projects'>Projects</Link>
{/* <Link to='/activities'>Activities</Link> */}
<Link to='/about'>About Me</Link>

View File

@@ -2,7 +2,6 @@ import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';
import reportWebVitals from './reportWebVitals';
import './responsive.js'
const container = document.getElementById('root');
const root = createRoot(container);

View File

@@ -1,28 +1,27 @@
window.onload = function () { onLoaded() };
window.onpageshow = function () { onLoaded() };
function onLoaded() {
scrollFunction();
resizer();
window.onresize = function () { resizer() };
document.getElementById("menu").onclick = function () { toggleMenu() };
resizer();
}
function resizer() {
scrollFunction();
const e = document.querySelector(".navControl");
if (window.innerWidth > 1200) { // desktop view
window.onscroll = function () { scrollFunction() };
bottomBorderOff();
e.style.maxHeight = `${e.scrollHeight + 10}px`;
window.onscroll = function () { scrollFunction() };
}
else { // mobile view
e.style.maxHeight = '0px';
bottomBorderOn();
window.onscroll = '';
document.querySelector('.header').style.backgroundColor = '#1a1a1a';
document.querySelector('.header > a > h1').style.fontSize = "1.5rem";
// document.querySelector('.header > h1').style.color = "#a8a8a8";
document.querySelectorAll('.navElement').forEach(x => { x.style.paddingTop = '.3rem'; x.style.paddingBottom = '.3rem'; x.style.fontSize = '1rem' });
e.style.maxHeight = '0px';
bottomBorderOn();
}
}